diff --git a/clientsession_test.go b/clientsession_test.go index 12ef1f2..c455f6e 100644 --- a/clientsession_test.go +++ b/clientsession_test.go @@ -363,6 +363,10 @@ func TestFeatureChatRelayFederation(t *testing.T) { "mention-id": "federated_user/" + hello2.Hello.UserId + "@" + getCloudUrl(server2.URL), "server": server2.URL, }, + "mention-call": { + "type": "call", + "id": roomId, + }, }, } federatedChatComment := map[string]any{ @@ -390,6 +394,10 @@ func TestFeatureChatRelayFederation(t *testing.T) { "name": "User 2", "mention-id": "federated_user/" + hello2.Hello.UserId + "@" + getCloudUrl(server2.URL), }, + "mention-call": { + "type": "call", + "id": federatedRoomId, + }, }, } message := api.StringMap{ diff --git a/federation.go b/federation.go index 2d5cb4a..f19e955 100644 --- a/federation.go +++ b/federation.go @@ -648,20 +648,30 @@ func (c *FederationClient) updateComment(comment api.StringMap, localCloudUrl st continue } - if ptype, found := api.GetStringMapString[string](param, "type"); found && ptype == "user" { - if server, found := api.GetStringMapString[string](param, "server"); found && server == localUrl { - delete(param, "server") - params[key] = param - changed = true - continue - } + if ptype, found := api.GetStringMapString[string](param, "type"); found { + switch ptype { + case "user": + if server, found := api.GetStringMapString[string](param, "server"); found && server == localUrl { + delete(param, "server") + params[key] = param + changed = true + continue + } - if _, found := api.GetStringMapString[string](param, "mention-id"); !found { - param["mention-id"] = param["id"] - param["server"] = remoteUrl - params[key] = param - changed = true - continue + if _, found := api.GetStringMapString[string](param, "mention-id"); !found { + param["mention-id"] = param["id"] + param["server"] = remoteUrl + params[key] = param + changed = true + continue + } + case "call": + roomId := c.RoomId() + remoteRoomId := c.RemoteRoomId() + // TODO: Should we also rewrite the room avatar url in "icon-url"? + if c.changeRoomId.Load() && param["id"] == remoteRoomId { + param["id"] = roomId + } } } }