Skip to content

Commit

Permalink
feat(chat): Add the mention id to parameters for easier editing
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Jan 31, 2025
1 parent b5fedb1 commit a2f2504
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/Chat/Parser/UserMention.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ protected function parseMessage(Message $chatMessage): void {
'name' => $chatMessage->getRoom()->getDisplayName($userId, true),
'call-type' => $this->getRoomType($chatMessage->getRoom()),
'icon-url' => $this->avatarService->getAvatarUrl($chatMessage->getRoom()),
'mention-id' => $search,
];
} elseif ($mention['type'] === 'guest') {
try {
Expand All @@ -174,6 +175,7 @@ protected function parseMessage(Message $chatMessage): void {
'type' => $mention['type'],
'id' => $mention['id'],
'name' => $displayName,
'mention-id' => $search,
];
} elseif ($mention['type'] === 'email') {
try {
Expand All @@ -187,6 +189,7 @@ protected function parseMessage(Message $chatMessage): void {
'type' => $mention['type'],
'id' => $mention['id'],
'name' => $displayName,
'mention-id' => $search,
];
} elseif ($mention['type'] === 'federated_user') {
try {
Expand All @@ -206,7 +209,8 @@ protected function parseMessage(Message $chatMessage): void {
'type' => 'user',
'id' => $cloudId->getUser(),
'name' => $displayName,
'server' => $cloudId->getRemote()
'server' => $cloudId->getRemote(),
'mention-id' => $search,
];
} elseif ($mention['type'] === 'group') {
$group = $this->groupManager->get($mention['id']);
Expand All @@ -220,6 +224,7 @@ protected function parseMessage(Message $chatMessage): void {
'type' => 'user-group',
'id' => $mention['id'],
'name' => $displayName,
'mention-id' => $search,
];
} elseif ($mention['type'] === 'team') {
$messageParameters[$mentionParameterId] = $this->getCircle($mention['id']);
Expand All @@ -236,6 +241,7 @@ protected function parseMessage(Message $chatMessage): void {
'type' => $mention['type'],
'id' => $mention['id'],
'name' => $displayName,
'mention-id' => $search,
];
}
}
Expand Down Expand Up @@ -293,6 +299,7 @@ protected function getCircle(string $circleId): array {
'id' => $circleId,
'name' => $this->circleNames[$circleId],
'link' => $this->circleLinks[$circleId],
'mention-id' => 'team/' . $circleId,
];
}

Expand Down

0 comments on commit a2f2504

Please sign in to comment.