Skip to content
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 mention bubbles not rendered in comment editor #35053

Closed

Conversation

danxuliu
Copy link
Member

@danxuliu danxuliu commented Nov 9, 2022

The NcRichContenteditable requires the userData property to be given to render the mention bubbles. Otherwise after selecting a candidate mention just @ followed by the user id is shown in plain text.

To solve that now the data of the candidate mentions is cached whenever the autocomplete list is shown, and reset once a comment has been sent.

How to test

  • Open the Files app
  • Show the sidebar for any file
  • Open the Comments tab
  • In the new comment text, type @ and mention any user

Result with this pull request

A mention bubble is added

Result without this pull request

The user id is written in plain text

@danxuliu danxuliu added this to the Nextcloud 26 milestone Nov 9, 2022
@danxuliu danxuliu requested review from skjnldsv, a team, PVince81 and artonge and removed request for a team November 9, 2022 12:54
@danxuliu
Copy link
Member Author

danxuliu commented Nov 9, 2022

/backport to stable25

@danxuliu
Copy link
Member Author

danxuliu commented Nov 9, 2022

/backport to stable24

@danxuliu
Copy link
Member Author

danxuliu commented Nov 9, 2022

/backport to stable23

@nextcloud-command nextcloud-command force-pushed the fix-mention-bubbles-not-rendered-in-comment-editor branch from 03b87a3 to 66941e3 Compare November 9, 2022 17:29
@danxuliu danxuliu force-pushed the fix-mention-bubbles-not-rendered-in-comment-editor branch from 66941e3 to a16899d Compare November 11, 2022 10:13
@danxuliu
Copy link
Member Author

/compile amend /

The NcRichContenteditable requires the "userData" property to be given
to render the mention bubbles. Otherwise after selecting a candidate
mention just "@" followed by the user id is shown in plain text.

To solve that now the data of the candidate mentions is cached whenever
the autocomplete list is shown, and reset once a comment has been sent.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
@nextcloud-command nextcloud-command force-pushed the fix-mention-bubbles-not-rendered-in-comment-editor branch from a16899d to fedc7f4 Compare November 11, 2022 10:23
@artonge
Copy link
Contributor

artonge commented Nov 15, 2022

Hey @danxuliu very sorry, I saw this PR notification but didn't make the link.

When fixing it, I noticed that the issue also occurs when editing an existing comment and adding a mention. To fix it, I also had to add this: https://github.com/nextcloud/server/pull/35187/files#diff-b569f730b67ed3363f41a268df4d68e6693d02b2eddb278194ddb7326f8b041aL178-R194

Can you check your PR and add it too if necessary ?

@danxuliu
Copy link
Member Author

Hey @danxuliu very sorry, I saw this PR notification but didn't make the link.

No problem at all :-)

When fixing it, I noticed that the issue also occurs when editing an existing comment and adding a mention. To fix it, I also had to add this: https://github.com/nextcloud/server/pull/35187/files#diff-b569f730b67ed3363f41a268df4d68e6693d02b2eddb278194ddb7326f8b041aL178-R194

Can you check your PR and add it too if necessary ?

That is a very good point, my pull request only fixes new comments, but not editing existing ones. Moreover, as the user data is shared between all comments at all time it is not possible to reset the candidate mentions when a comment is sent like done here. Therefore, if you are OK with that, I would instead close my pull request in favour of yours :-)

@danxuliu
Copy link
Member Author

Closed in favour of #35187

@danxuliu danxuliu closed this Nov 16, 2022
@danxuliu danxuliu deleted the fix-mention-bubbles-not-rendered-in-comment-editor branch November 16, 2022 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants