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): Support mentioning emails #48760

Merged
merged 3 commits into from
Oct 18, 2024

Conversation

nickvergessen
Copy link
Member

Checklist

@nickvergessen
Copy link
Member Author

/backport to stable30

@nickvergessen nickvergessen force-pushed the feat/noid/support-email-mentions branch from 52eccbc to b61a8cf Compare October 17, 2024 12:28
Copy link
Member

@danxuliu danxuliu left a comment

Choose a reason for hiding this comment

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

Looks good, but please add a test in

public function mentionsProvider(): array {
return [
[
'@alice @bob look look, a cook!',
[['type' => 'user', 'id' => 'alice'], ['type' => 'user', 'id' => 'bob']],
],
[
'no mentions in this message',
[]
],
[
'@alice @bob look look, a duplication @alice test @bob!',
[['type' => 'user', 'id' => 'alice'], ['type' => 'user', 'id' => 'bob']],
],
[
'@alice is the author, notify @bob, nevertheless mention her!',
[['type' => 'user', 'id' => 'alice'], ['type' => 'user', 'id' => 'bob']],
/* author: */ 'alice'
],
[
'@foobar and @barfoo you should know, @[email protected] is valid' .
' and so is @[email protected]@foobar.io I hope that clarifies everything.' .
' cc @23452-4333-54353-2342 @yolo!' .
' however the most important thing to know is that www.croissant.com/@oil is not valid' .
' and won\'t match anything at all',
[
['type' => 'user', 'id' => '[email protected]@foobar.io'],
['type' => 'user', 'id' => '23452-4333-54353-2342'],
['type' => 'user', 'id' => '[email protected]'],
['type' => 'user', 'id' => 'foobar'],
['type' => 'user', 'id' => 'barfoo'],
['type' => 'user', 'id' => 'yolo'],
],
],
[
'@@chef is also a valid mention, no matter how strange it looks',
[['type' => 'user', 'id' => '@chef']],
],
[
'Also @"user with spaces" are now supported',
[['type' => 'user', 'id' => 'user with spaces']],
],
[
'Also @"guest/0123456789abcdef" are now supported',
[['type' => 'guest', 'id' => 'guest/0123456789abcdef']],
],
[
'Also @"group/My Group ID 321" are now supported',
[['type' => 'group', 'id' => 'My Group ID 321']],
],
[
'Welcome federation @"federated_group/My Group ID 321" @"federated_team/Former Cirle" @"federated_user/cloudId@http://example.tld:8080/nextcloud"! Now freshly supported',
[
['type' => 'federated_user', 'id' => 'cloudId@http://example.tld:8080/nextcloud'],
['type' => 'federated_group', 'id' => 'My Group ID 321'],
['type' => 'federated_team', 'id' => 'Former Cirle'],
],
],
];
}

Copy link
Member

@danxuliu danxuliu left a comment

Choose a reason for hiding this comment

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

Thanks!

CI failures should be unrelated.

@nickvergessen nickvergessen merged commit e65f310 into master Oct 18, 2024
174 of 177 checks passed
@nickvergessen nickvergessen deleted the feat/noid/support-email-mentions branch October 18, 2024 06:20
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.

3 participants