From f91fafd7a1d32f8b0b83d347594ce6b92d98165c Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Tue, 25 Jan 2022 12:35:09 -0600 Subject: [PATCH] Only have Matrix room links for public rooms And if the Gitter room does not have a `uri` like `ONE_TO_ONE` rooms, then use the Matrix room ID instead. --- server/serializers/rest/troupe-strategy.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/server/serializers/rest/troupe-strategy.js b/server/serializers/rest/troupe-strategy.js index 31eeb1a51..f6bc045f2 100644 --- a/server/serializers/rest/troupe-strategy.js +++ b/server/serializers/rest/troupe-strategy.js @@ -327,12 +327,20 @@ function TroupeStrategy(options) { user: otherUser }); + // Let's only have a Matrix room link for public rooms otherwise people will + // be confused when they can't see their own private or one to one rooms on + // Matrix even they are still bridged behind the scenes let matrixRoomLink; - if (matrixBridgedRoomStrategy) { - if (matrixBridgedRoomStrategy.map(id)) { - matrixRoomLink = `https://matrix.to/#/${getCanonicalAliasForGitterRoomUri( - item.uri - )}?utm_source=gitter`; + if (matrixBridgedRoomStrategy && isPublic) { + const matrixRoomId = matrixBridgedRoomStrategy.map(id); + if (matrixRoomId) { + // ONE_TO_ONE rooms don't have a `uri` so lets default to the matrixRoomId instead + let roomAliasOrId = matrixRoomId; + if (item.uri) { + roomAliasOrId = getCanonicalAliasForGitterRoomUri(item.uri); + } + + matrixRoomLink = `https://matrix.to/#/${roomAliasOrId}?utm_source=gitter`; } } -- 2.11.4.GIT