You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-07 10:46:24 +03:00
show a pill as a moderated alias (canonical or alt) if available
otherwise, display as the label in the link
This commit is contained in:
@@ -237,7 +237,15 @@ const Pill = createReactClass({
|
|||||||
case Pill.TYPE_ROOM_MENTION: {
|
case Pill.TYPE_ROOM_MENTION: {
|
||||||
const room = this.state.room;
|
const room = this.state.room;
|
||||||
if (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) {
|
if (this.props.shouldShowPillAvatar) {
|
||||||
avatar = <RoomAvatar room={room} width={16} height={16} aria-hidden="true" />;
|
avatar = <RoomAvatar room={room} width={16} height={16} aria-hidden="true" />;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user