From 48018615f8d744018652de81bbbb8129afff447d Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Mon, 30 Nov 2020 12:48:26 +0000 Subject: [PATCH] Add support for linking to the remote network page --- src/components/views/settings/BridgeTile.tsx | 23 ++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/components/views/settings/BridgeTile.tsx b/src/components/views/settings/BridgeTile.tsx index f47d47cb40..062fdbeb6e 100644 --- a/src/components/views/settings/BridgeTile.tsx +++ b/src/components/views/settings/BridgeTile.tsx @@ -27,6 +27,7 @@ import {replaceableComponentTs} from "../../../utils/replaceableComponent"; import SettingsStore from "../../../settings/SettingsStore"; import {MatrixEvent} from "matrix-js-sdk/src/models/event"; import { Room } from "matrix-js-sdk/src/models/room"; +import { isUrlPermitted } from '../../../HtmlUtils'; interface IProps { ev: MatrixEvent; @@ -117,6 +118,22 @@ export default class BridgeTile extends React.PureComponent { } else { networkIcon =
; } + let networkItem = null; + if (network) { + const networkName = network.displayname || network.id; + let networkLink = {networkName}; + if (typeof network.external_url === "string" && isUrlPermitted(network.external_url)) { + networkLink = {networkName} + } + networkItem = _t("Workspace: ", {}, { + networkLink: () => networkLink, + }); + } + + let channelLink = {channelName}; + if (typeof channel.external_url === "string" && isUrlPermitted(channel.external_url)) { + channelLink = {channelName} + } const id = this.props.ev.getId(); return (
  • @@ -126,8 +143,10 @@ export default class BridgeTile extends React.PureComponent {

    {protocolName}

    - {_t("Workspace: %(networkName)s", {networkName})} - {_t("Channel: %(channelName)s", {channelName})} + {networkItem} + {_t("Channel: ", {}, { + channelLink: () => channelLink + })}

      {creator} {bot}