fix(Comments): sort by id (not type+id) in getMentions#56162
Open
joshtrichards wants to merge 2 commits intomasterfrom
Open
fix(Comments): sort by id (not type+id) in getMentions#56162joshtrichards wants to merge 2 commits intomasterfrom
joshtrichards wants to merge 2 commits intomasterfrom
Conversation
Updated the docblock for the getMentions method to clarify its return value and sorting behavior. Signed-off-by: Josh <josh.t.richards@gmail.com>
Updated the getMentions method to inherit documentation and change sorting logic. Signed-off-by: Josh <josh.t.richards@gmail.com>
CarlSchwan
approved these changes
Nov 3, 2025
Comment on lines
184
to
186
| /** | ||
| * returns an array containing mentions that are included in the comment | ||
| * | ||
| * @return array each mention provides a 'type' and an 'id', see example below | ||
| * @psalm-return list<array{type: 'guest'|'email'|'federated_group'|'group'|'federated_team'|'team'|'federated_user'|'user', id: non-empty-lowercase-string}> | ||
| * @since 30.0.2 Type 'email' is supported | ||
| * @since 29.0.0 Types 'federated_group', 'federated_team', 'team' and 'federated_user' are supported | ||
| * @since 23.0.0 Type 'group' is supported | ||
| * @since 17.0.0 Type 'guest' is supported | ||
| * @since 11.0.0 | ||
| * @inheritDoc | ||
| */ |
Member
There was a problem hiding this comment.
I would completely remove that block and add a #[Override] instead
Comment on lines
+230
to
+232
| usort($result, static function ($mention1, $mention2) { | ||
| return mb_strlen($mention2['id']) <=> mb_strlen($mention1['id']); | ||
| }); |
Member
There was a problem hiding this comment.
Suggested change
| usort($result, static function ($mention1, $mention2) { | |
| return mb_strlen($mention2['id']) <=> mb_strlen($mention1['id']); | |
| }); | |
| usort($result, static fn (array $mention1, array $mention2): int => mb_strlen($mention2['id']) <=> mb_strlen($mention1['id'])); |
While at it ;)
Comment on lines
+131
to
132
| * @return array Each mention is an associative array with 'type' and 'id' keys, sorted by descending length. | ||
| * @psalm-return list<array{type: 'guest'|'email'|'federated_group'|'group'|'federated_team'|'team'|'federated_user'|'user', id: non-empty-lowercase-string}> |
Member
There was a problem hiding this comment.
Suggested change
| * @return array Each mention is an associative array with 'type' and 'id' keys, sorted by descending length. | |
| * @psalm-return list<array{type: 'guest'|'email'|'federated_group'|'group'|'federated_team'|'team'|'federated_user'|'user', id: non-empty-lowercase-string}> | |
| * @return list<array{type: 'guest'|'email'|'federated_group'|'group'|'federated_team'|'team'|'federated_user'|'user', id: non-empty-lowercase-string}> Each mention is an associative array with 'type' and 'id' keys, sorted by descending length. |
Merge the two @return annotation
miaulalala
reviewed
Nov 4, 2025
| * @since 30.0.2 Type 'email' is supported | ||
| * @since 29.0.0 Types 'federated_group', 'federated_team', 'team' and 'federated_user' are supported | ||
| * @since 23.0.0 Type 'group' is supported | ||
| * @since 21.0.1 Sort returned results by |
Merged
This was referenced Jan 29, 2026
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TODO
Checklist
3. to review, feature component)stable32)