Tweak as per git review

pull/21833/head
Half-Shot 2020-01-03 13:57:59 +00:00
parent fa9fd97a4e
commit 668479d94a
2 changed files with 35 additions and 42 deletions

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2019 New Vector Ltd Copyright 2019 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -33,17 +33,6 @@ export default class BridgeSettingsTab extends React.Component {
roomId: PropTypes.string.isRequired, roomId: PropTypes.string.isRequired,
}; };
constructor() {
super();
this.state = {
};
}
componentWillMount() {
}
_renderBridgeCard(event, room) { _renderBridgeCard(event, room) {
const content = event.getContent(); const content = event.getContent();
if (!content || !content.channel || !content.protocol) { if (!content || !content.channel || !content.protocol) {
@ -56,21 +45,18 @@ export default class BridgeSettingsTab extends React.Component {
let creator = null; let creator = null;
if (content.creator) { if (content.creator) {
const pill = <Pill creator = <p> { _t("This bridge was provisioned by <user />", {}, {
type={Pill.TYPE_USER_MENTION} user: <Pill
room={room} type={Pill.TYPE_USER_MENTION}
url={makeUserPermalink(content.creator)} room={room}
shouldShowPillAvatar={true} url={makeUserPermalink(content.creator)}
/>; shouldShowPillAvatar={true}
creator = (<p>{ />,
_t("This bridge was provisioned by %(pill)s", { })}</p>;
pill,
})
} </p>);
} }
const bot = (<p> {_t("This bridge is managed by the %(pill)s bot user.", { const bot = (<p> {_t("This bridge is managed by the <user /> bot user.", {}, {
pill: <Pill user: <Pill
type={Pill.TYPE_USER_MENTION} type={Pill.TYPE_USER_MENTION}
room={room} room={room}
url={makeUserPermalink(event.getSender())} url={makeUserPermalink(event.getSender())}
@ -79,20 +65,20 @@ export default class BridgeSettingsTab extends React.Component {
})} </p>); })} </p>);
let channelLink = channelName; let channelLink = channelName;
if (channel.external_url) { if (channel.external_url) {
channelLink = <a target="_blank" href={channel.external_url}>{channelName}</a>; channelLink = <a target="_blank" href={channel.external_url} rel="noopener">{channelName}</a>;
} }
let networkLink = networkName; let networkLink = networkName;
if (network && network.external_url) { if (network && network.external_url) {
networkLink = <a target="_blank" href={network.external_url}>{networkName}</a>; networkLink = <a target="_blank" href={network.external_url} rel="noopener">{networkName}</a>;
} }
const chanAndNetworkInfo = ( const chanAndNetworkInfo = (
(_t("Bridged into %(channelLink)s %(networkLink)s, on %(protocolName)s", { _t("Bridged into <channelLink /> <networkLink />, on <protocolName />", {}, {
channelLink, channelLink,
networkLink, networkLink,
protocolName, protocolName,
})) })
); );
let networkIcon = null; let networkIcon = null;
@ -101,9 +87,13 @@ export default class BridgeSettingsTab extends React.Component {
MatrixClientPeg.get().getHomeserverUrl(), MatrixClientPeg.get().getHomeserverUrl(),
network.avatar, 32, 32, "crop", network.avatar, 32, 32, "crop",
); );
networkIcon = <BaseAvatar width={32} height={32} resizeMethod='crop' networkIcon = <BaseAvatar
name={ networkName } idName={ networkName } width={32}
url={ avatarUrl } />; height={32}
resizeMethod='crop'
name={ networkName }
idName={ networkName }
url={ avatarUrl } />;
} }
let channelIcon = null; let channelIcon = null;
@ -112,13 +102,16 @@ export default class BridgeSettingsTab extends React.Component {
MatrixClientPeg.get().getHomeserverUrl(), MatrixClientPeg.get().getHomeserverUrl(),
channel.avatar, 32, 32, "crop", channel.avatar, 32, 32, "crop",
); );
console.log(channel.avatar); channelIcon = <BaseAvatar
channelIcon = <BaseAvatar width={32} height={32} resizeMethod='crop' width={32}
name={ networkName } idName={ networkName } height={32}
url={ avatarUrl } />; resizeMethod='crop'
name={ networkName }
idName={ networkName }
url={ avatarUrl } />;
} }
const heading = _t("Connected to %(channelIcon)s %(channelName)s on %(networkIcon)s %(networkName)s", { const heading = _t("Connected to <channelIcon /> <channelName /> on <networkIcon /> <networkName />", { }, {
channelIcon, channelIcon,
channelName, channelName,
networkName, networkName,
@ -127,7 +120,7 @@ export default class BridgeSettingsTab extends React.Component {
return (<li key={event.stateKey}> return (<li key={event.stateKey}>
<div> <div>
<h3> {heading} </h3> <h3>{heading}</h3>
<p>{_t("Connected via %(protocolName)s", { protocolName })}</p> <p>{_t("Connected via %(protocolName)s", { protocolName })}</p>
<details> <details>
{creator} {creator}

View File

@ -763,10 +763,10 @@
"Room version:": "Room version:", "Room version:": "Room version:",
"Developer options": "Developer options", "Developer options": "Developer options",
"Open Devtools": "Open Devtools", "Open Devtools": "Open Devtools",
"This bridge was provisioned by %(pill)s": "This bridge was provisioned by %(pill)s", "This bridge was provisioned by <user />": "This bridge was provisioned by <user />",
"This bridge is managed by the %(pill)s bot user.": "This bridge is managed by the %(pill)s bot user.", "This bridge is managed by the <user /> bot user.": "This bridge is managed by the <user /> bot user.",
"Bridged into %(channelLink)s %(networkLink)s, on %(protocolName)s": "Bridged into %(channelLink)s %(networkLink)s, on %(protocolName)s", "Bridged into <channelLink /> <networkLink />, on <protocolName />": "Bridged into <channelLink /> <networkLink />, on <protocolName />",
"Connected to %(channelIcon)s %(channelName)s on %(networkIcon)s %(networkName)s": "Connected to %(channelIcon)s %(channelName)s on %(networkIcon)s %(networkName)s", "Connected to <channelIcon /> <channelName /> on <networkIcon /> <networkName />": "Connected to <channelIcon /> <channelName /> on <networkIcon /> <networkName />",
"Connected via %(protocolName)s": "Connected via %(protocolName)s", "Connected via %(protocolName)s": "Connected via %(protocolName)s",
"Bridge Info": "Bridge Info", "Bridge Info": "Bridge Info",
"Below is a list of bridges connected to this room.": "Below is a list of bridges connected to this room.", "Below is a list of bridges connected to this room.": "Below is a list of bridges connected to this room.",