fix: get user by display name
- Resolves: #4169
- Target version: main
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
- [x] Code is properly formatted
- [x] Sign-off message is added to all commits
- [x] Documentation (manuals or wiki) has been updated or is not required
/backport to stable30
/backport to stable29
/backport to stable28
/backport to stable27
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 (OCP\Collaboration\AutoComplete\IManager) would be better?
What comes to my mind only now is that it probably does not respect various sharing settings, e.g. auto completion of users.
I think this is already done here in the front end, unless I'm mistaken: https://github.com/nextcloud/richdocuments/blob/404d072a2ca73bd53aeafcca3f7d68745a0f8347/src/mixins/uiMention.js#L19-L21
@blizzz