@@ -108,6 +108,7 @@ public function LocalizeRemoteBoard(array $remoteBoard, Board $localBoard) {
108108 $ remoteBoard ['acl ' ] = $ localBoard ->getAcl ();
109109 $ remoteBoard ['permissions ' ] = $ localBoard ->getPermissions ();
110110 $ remoteBoard ['users ' ] = $ this ->localizeRemoteUsers ($ remoteBoard ['users ' ], $ localBoard );
111+ $ remoteBoard ['externalId ' ] = $ localBoard ->getExternalId ();
111112 return $ remoteBoard ;
112113 }
113114
@@ -122,6 +123,7 @@ public function localizeRemoteUsers(array $users, Board $localBoard) {
122123
123124 public function localizeRemoteComments (Board $ localBoard , array $ comments ): array {
124125 foreach ($ comments as $ i => $ comment ) {
126+ // Localize actors
125127 $ localizedActor = $ this ->localizeRemoteUser ($ localBoard , ['uid ' => $ comment ['actorId ' ], 'remote ' => $ comment ['actorRemote ' ]]);
126128 if ($ localizedActor instanceof FederatedUser) {
127129 $ comments [$ i ]['actorDisplayName ' ] = $ localizedActor ->getCloudId ()->getId ();
@@ -146,6 +148,25 @@ public function localizeRemoteComments(Board $localBoard, array $comments): arra
146148 $ comments [$ i ]['replyTo ' ]['actorRemote ' ] = null ;
147149 }
148150 }
151+
152+ // Localize mentions
153+ foreach ($ comment ['mentions ' ] as $ j => $ mention ) {
154+ $ localizedMention = $ this ->localizeRemoteUser ($ localBoard , ['uid ' => $ mention ['mentionId ' ], 'remote ' => $ mention ['mentionRemote ' ]]);
155+ if ($ localizedMention instanceof User) {
156+ $ comments [$ i ]['message ' ] = str_replace ('@"federated_user/ ' . $ mention ['mentionId ' ], '@" ' . $ localizedMention ->getUID (), $ comment ['message ' ]);
157+ $ comments [$ i ]['mentions ' ][$ j ]['mentionDisplayName ' ] = $ localizedMention ->getDisplayName ();
158+ $ comments [$ i ]['mentions ' ][$ j ]['mentionId ' ] = $ localizedMention ->getUID ();
159+ $ comments [$ i ]['mentions ' ][$ j ]['mentionRemote ' ] = null ;
160+ $ comments [$ i ]['mentions ' ][$ j ]['mentionType ' ] = 'user ' ;
161+ }
162+ if ($ localizedMention instanceof FederatedUser) {
163+ $ comments [$ i ]['message ' ] = str_replace ('@ ' . $ mention ['mentionId ' ], '@federated_user/ ' . $ localizedMention ->getUID (), $ comment ['message ' ]);
164+ $ comments [$ i ]['mentions ' ][$ j ]['mentionDisplayName ' ] = $ localizedMention ->getCloudId ()->getId ();
165+ $ comments [$ i ]['mentions ' ][$ j ]['mentionId ' ] = $ localizedMention ->getCloudId ()->getId ();
166+ $ comments [$ i ]['mentions ' ][$ j ]['mentionRemote ' ] = $ localizedMention ->getCloudId ()->getRemote ();
167+ $ comments [$ i ]['mentions ' ][$ j ]['mentionType ' ] = 'federated_user ' ;
168+ }
169+ }
149170 }
150171 return $ comments ;
151172 }
@@ -499,6 +520,7 @@ public function createCardCommentOnRemote(Board $localBoard, int $cardId, string
499520 $ participantCloudId = $ this ->cloudIdManager ->getCloudId ($ this ->userId , null );
500521 $ ownerCloudId = $ this ->cloudIdManager ->resolveCloudId ($ localBoard ->getOwner ());
501522 $ url = $ ownerCloudId ->getRemote () . '/ocs/v2.php/apps/deck/api/v1.0/cards/ ' . $ cardId . '/comments ' ;
523+
502524 $ params = [
503525 'boardId ' => $ localBoard ->getExternalId (),
504526 'message ' => $ message ,
0 commit comments