summaryrefslogtreecommitdiffstats
path: root/lib/Controller
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2024-02-27 18:24:08 +0100
committerJoas Schilling <coding@schilljs.com>2024-02-28 12:40:03 +0100
commit34dcb545e67dfda9125fea8002b3f7d06f9094c9 (patch)
tree63bd92c8ceca55bb09c5a28f694c4e1bd2fe7bd2 /lib/Controller
parentb2e98443f0fee44582b792997ab2244ded3c25b2 (diff)
feat(federation): Support mentioning federated users
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Controller')
-rw-r--r--lib/Controller/ChatController.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Controller/ChatController.php b/lib/Controller/ChatController.php
index a98cebfa2..0c92b6eab 100644
--- a/lib/Controller/ChatController.php
+++ b/lib/Controller/ChatController.php
@@ -1279,6 +1279,7 @@ class ChatController extends AEnvironmentAwareController {
'id' => $result['value']['shareWith'],
'label' => $result['label'],
'source' => $type,
+ 'mentionId' => $this->createMentionString($type, $result['value']['shareWith']),
];
if ($type === Attendee::ACTOR_USERS && isset($statuses[$data['id']])) {
@@ -1293,4 +1294,13 @@ class ChatController extends AEnvironmentAwareController {
}
return $output;
}
+
+ protected function createMentionString(string $type, string $id): string {
+ if ($type !== Attendee::ACTOR_FEDERATED_USERS) {
+ return $id;
+ }
+
+ // We want "federated_user/admin@example.tld" so we have to strip off the trailing "s" from the type "federated_users"
+ return substr($type, 0, -1) . '/' . $id;
+ }
}