-
Notifications
You must be signed in to change notification settings - Fork 117
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
fix: get user by display name #4171
Conversation
/backport to stable30 |
/backport to stable29 |
/backport to stable28 |
/backport to stable27 |
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.
Comes with a suggestion.
lib/Controller/MentionController.php
Outdated
@@ -39,14 +41,20 @@ public function mention(int $fileId, string $mention): DataResponse { | |||
return new DataResponse([], Http::STATUS_NOT_FOUND); | |||
} | |||
|
|||
$userFolder = $this->rootFolder->getUserFolder($mention); | |||
$userResults = $this->userManager->searchDisplayName($mention, 1); |
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 think this is a design flaw of the post message API that is not returning us a real unique identifier. Worth to file upstream to further discuss, but fine as a workaround with me now.
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.
File upstream where exactly? Should we rather have Collabora return the UID rather than display name?
What comes to my mind only now is that it probably does not respect various sharing settings, e.g. auto completion of users. Unless the "mention" is filtered somewhere before. Maybe the autocomplete logic ( |
Signed-off-by: Elizabeth Danzberger <[email protected]>
95e362a
to
51f0e57
Compare
I think this is already done here in the front end, unless I'm mistaken: richdocuments/src/mixins/uiMention.js Lines 19 to 21 in 404d072
|
Summary
When mentioning a user within a document from Collabora, it seems to search by the user's display name. Thus, if the display name has any whitespace, it will fail to mention the user. The problem is that the backend tries to use the mentioned user string (display name in this case) as the UID, which is not the same. The solution is to first search by the display name to get the proper user object, then use the UID from that to generate the notification and send it to the user.
Checklist