-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
comment mentions: show displayname not uid #1738
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
comment mentions: show displayname not uid #1738
Conversation
|
@blizzz, thanks for your PR! By analyzing the history of the files in this pull request, we identified @rullzer, @nickvergessen and @LukasReschke to be potential reviewers. |
|
This is on "rendering" the comment? |
Yes, essentially 2. and 4. from #753. 2 alone without 4 is too cumbersome as it would introduce too much client business logic that then would be worthless when doing 4. |
| // exclude author, no self-mentioning | ||
| if($uid === '@' . $this->getActorId()) { | ||
| continue; | ||
| } |
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.
So far we plan only to support mentioning users. In the back of the head, mentioning groups in future might be reasonable. Thus we add a "type" key, however I am uncertain how we would implement this. Then there is a question whether a custom app would want to notify other, custom things. Is this legitimate? We could do this by extending the pattern and perhaps prepend a type between @ and the identifier (and defaulting to users). Just as food for thought.
95fa09c to
9d97c7f
Compare
|
Unsure about JS tests yet, thus still developing, otherwise I am happy about feedback – what do you think? @nickvergessen @rullzer @MorrisJobke (and anyone else is welcome, too :) ) |
| 'objectId': '{' + NS_OWNCLOUD + '}objectId', | ||
| 'isUnread': '{' + NS_OWNCLOUD + '}isUnread' | ||
| 'isUnread': '{' + NS_OWNCLOUD + '}isUnread', | ||
| 'mentions': '{' + NS_OWNCLOUD + '}mentions' |
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.
should we start our namespace?
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 we pointed out once we stay with the current namespaces.
apps/comments/js/commentstabview.js
Outdated
| for(var i in mentions) { | ||
| var mention = '@' + mentions[i].mentionId; | ||
| mention = mention.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); | ||
| var displayName = '<b>'+ _.escape(mentions[i].mentionDisplayName)+'</b>'; |
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.
strong instead of b?
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.
add avatar?
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.
@nextcloud/designers wishes how it shoud look like?
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.
That is what I should use in the activity app and I guess it's the same everywhere: https://github.com/nextcloud/activity/blob/master/js/formatter.js#L145-L148
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.
implemented
|
|
||
| for(var i in mentions) { | ||
| var mention = '@' + mentions[i].mentionId; | ||
| mention = mention.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); |
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.
If you mention a user test and testname this breaks?
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.
Almost there… but it is impossible to parse everything properly.
Example:
"Let's talk about it today, @foobar."
Since we allow dots, @foobar and @foobar. are possible scenarios here. If you have both? Would be silly to insert a space between the username and the fullstop.
But even better it is that we allow white spaces in usernames now:
"@alice Bernadette wants to talk"
Username can be '@Alice Bernadette``or'@Alice``(or both).
For now, I improve the Regexp to have the 98% solution, butt when going with autocomplete I am afraid we need to wrap the mention into brackets to be able to support all these funny usernames.
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.
98% sounds good enough
| const PROPERTY_NAME_MENTION = '{http://owncloud.org/ns}mention'; | ||
| const PROPERTY_NAME_MENTION_TYPE = '{http://owncloud.org/ns}mentionType'; | ||
| const PROPERTY_NAME_MENTION_ID = '{http://owncloud.org/ns}mentionId'; | ||
| const PROPERTY_NAME_MENTION_DISPLAYNAME = '{http://owncloud.org/ns}mentionDisplayName'; |
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.
nextcloud? or too confusing?
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.
As in #1738 (comment) and yes, it would increase confusion.
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
d3b891d to
1854339
Compare
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
…ents Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
7d07922 to
b12b52b
Compare
|
Review time 🎉 |
Current coverage is 57.91% (diff: 71.23%)
|
|
Works now, I will fix activities to also show the user names and avatars in a second PR 👍 |
|
Tested and works 👍 |


contributes to #753, items 2 and 4.
comment flow
Tech background
In the back, the DAV endpoint will send mention information with the raw message.
The client (web ui here) replaces the uid with the displayname for presentation.
The next step (follow-up PR) will introduce autocomplete. After typing @ a search within the recipients of this file is supposed to happen. The client would make sure that the raw user id stays in the message, but its editing/composing abilities would hide this from the end user. That's the idea at least.
Todos left