-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle mention suggestions for third party users #6889
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6889 +/- ##
=======================================
Coverage 99.42% 99.42%
=======================================
Files 273 273
Lines 10509 10523 +14
Branches 2523 2529 +6
=======================================
+ Hits 10449 10463 +14
Misses 60 60 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
export type UserItem = { | ||
user: string; | ||
displayName: string | null; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This type was unused. It was likely something used at some point but then moved to a different module.
cbc3007
to
18cc6e2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than plumbing down the default authority through several levels of the tree, we could simplify this by deciding in AnnotationEditor
whether to use usernames or display names for all mentions, and passing that policy down to MarkdownEditor
and children (as a boolean, or enum). That way if we need to change the policy in future (eg. if there is a new third-party that does want us to show usernames), it will be easier to support.
Yeah, I considered this option. I ended up passing the authority down so that we could do the check for every individually suggested user. If we do it "globally" at the In future we could choose to change the logic to determine this. Do you have a better suggestion? |
You could decide "globally" based on the logged-in user, and that would work fine. You could also decide based on the author of the annotation, using the logged-in user ID as the author of new annotations. |
Yeah, I just realized I see it's also always set. I was not sure if it would be for new unsaved annotations. |
fc53f41
to
2efdbfa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good with a few corrections. I also had a query about how we are going to handle escaping [
and ]
in display names. If you want to handle that it a follow-up PR that would be fine, but I'd make sure it is tracked somewhere.
mentionMode: MentionMode, | ||
): string { | ||
return mentionMode === 'display-name' | ||
? `@[${user.displayName ?? ''}]` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no escaping of [
or ]
in display names here. Do you want to address that here or in a follow up? If in a follow-up I would add a brief comment about it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Escaping" could also involve replacing or stripping these characters. We don't need to be able to recover (ie. unescape) to get the original text in this context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I didn't think a user could use square brackets in their display name, but that's definitely a possibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created an issue to investigate this #6891
2efdbfa
to
ff0b8fe
Compare
Part of #6886
This PR does two things:
@[Display Name]
instead of@username
if they are a third party user.Note
This PR does not cover rendering those mentions. This will come on a follow-up PR.
For third party users:
third-party-mentions-2025-03-13_12.59.59.mp4
For first party users everything should continue working the same:
first-party-mentions-2025-03-13_13.00.46.mp4