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

feat(comments): Allow mentions of federated users, groups and teams #43875

Merged
merged 1 commit into from
Feb 28, 2024

Conversation

nickvergessen
Copy link
Member

… in the future

Checklist

…n the future

Signed-off-by: Joas Schilling <coding@schilljs.com>
@nickvergessen nickvergessen added enhancement 3. to review Waiting for reviews feature: comments pending documentation This pull request needs an associated documentation update labels Feb 27, 2024
@nickvergessen nickvergessen added this to the Nextcloud 29 milestone Feb 27, 2024
@nickvergessen nickvergessen self-assigned this Feb 27, 2024
@ChristophWurst ChristophWurst added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Feb 27, 2024
@@ -220,7 +220,7 @@ public function setMessage($message, $maxLength = self::MAX_MESSAGE_LENGTH): ICo
*
*/
public function getMentions(): array {
$ok = preg_match_all("/\B(?<![^a-z0-9_\-@\.\'\s])@(\"guest\/[a-f0-9]+\"|\"group\/[a-z0-9_\-@\.\' ]+\"|\"[a-z0-9_\-@\.\' ]+\"|[a-z0-9_\-@\.\']+)/i", $this->getMessage(), $mentions);
$ok = preg_match_all("/\B(?<![^a-z0-9_\-@\.\'\s])@(\"guest\/[a-f0-9]+\"|\"(?:federated_)?(?:group|team|user){1}\/[a-z0-9_\-@\.\' \/:]+\"|\"[a-z0-9_\-@\.\' ]+\"|[a-z0-9_\-@\.\']+)/i", $this->getMessage(), $mentions);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:
I think you can remove some \ since . lose it's special meaning between [ ]

Suggested change
$ok = preg_match_all("/\B(?<![^a-z0-9_\-@\.\'\s])@(\"guest\/[a-f0-9]+\"|\"(?:federated_)?(?:group|team|user){1}\/[a-z0-9_\-@\.\' \/:]+\"|\"[a-z0-9_\-@\.\' ]+\"|[a-z0-9_\-@\.\']+)/i", $this->getMessage(), $mentions);
$ok = preg_match_all("/\B(?<![^a-z0-9_\-@.'\s])@(\"guest\/[a-f0-9]+\"|\"(?:federated_)?(?:group|team|user){1}\/[a-z0-9_\-@.' \/:]+\"|\"[a-z0-9_\-@.' ]+\"|[a-z0-9_\-@.']+)/i", $this->getMessage(), $mentions);

@nickvergessen nickvergessen merged commit e802996 into master Feb 28, 2024
160 checks passed
@nickvergessen nickvergessen deleted the feat/noid/mention-for-federated-things branch February 28, 2024 00:06
@blizzz blizzz mentioned this pull request Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish enhancement feature: comments pending documentation This pull request needs an associated documentation update
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants