From 3c3839f8634f99fe17bd966753c55159e761abb7 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 21 Feb 2020 13:00:54 +0100 Subject: [PATCH] show a pill as a moderated alias (canonical or alt) if available otherwise, display as the label in the link --- src/components/views/elements/Pill.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/views/elements/Pill.js b/src/components/views/elements/Pill.js index 68e4e29337..34c1fd4c32 100644 --- a/src/components/views/elements/Pill.js +++ b/src/components/views/elements/Pill.js @@ -237,7 +237,15 @@ const Pill = createReactClass({ case Pill.TYPE_ROOM_MENTION: { const room = this.state.room; if (room) { - linkText = (room ? getDisplayAliasForRoom(room) : null) || resource; + const isModeratedAlias = room.getCanonicalAlias() === resource || + room.getAltAliases().includes(resource); + if (!isModeratedAlias) { + linkText = getDisplayAliasForRoom(room); + } + // if there are no moderated aliases, stick to resource + if (!linkText) { + linkText = resource; + } if (this.props.shouldShowPillAvatar) { avatar =