mirror of
https://github.com/element-hq/element-web
synced 2024-11-25 02:35:48 +03:00
Merge pull request #5218 from matrix-org/t3chguy/fix/15181
UI Feature Flag: Identity server
This commit is contained in:
commit
53ee5d82c7
5 changed files with 81 additions and 28 deletions
|
@ -38,6 +38,8 @@ import {Action} from "../../../dispatcher/actions";
|
||||||
import {DefaultTagID} from "../../../stores/room-list/models";
|
import {DefaultTagID} from "../../../stores/room-list/models";
|
||||||
import RoomListStore from "../../../stores/room-list/RoomListStore";
|
import RoomListStore from "../../../stores/room-list/RoomListStore";
|
||||||
import {CommunityPrototypeStore} from "../../../stores/CommunityPrototypeStore";
|
import {CommunityPrototypeStore} from "../../../stores/CommunityPrototypeStore";
|
||||||
|
import SettingsStore from "../../../settings/SettingsStore";
|
||||||
|
import {UIFeature} from "../../../settings/UIFeature";
|
||||||
|
|
||||||
// we have a number of types defined from the Matrix spec which can't reasonably be altered here.
|
// we have a number of types defined from the Matrix spec which can't reasonably be altered here.
|
||||||
/* eslint-disable camelcase */
|
/* eslint-disable camelcase */
|
||||||
|
@ -549,7 +551,7 @@ export default class InviteDialog extends React.PureComponent {
|
||||||
if (this.state.filterText.startsWith('@')) {
|
if (this.state.filterText.startsWith('@')) {
|
||||||
// Assume mxid
|
// Assume mxid
|
||||||
newMember = new DirectoryMember({user_id: this.state.filterText, display_name: null, avatar_url: null});
|
newMember = new DirectoryMember({user_id: this.state.filterText, display_name: null, avatar_url: null});
|
||||||
} else {
|
} else if (SettingsStore.getValue(UIFeature.IdentityServer)) {
|
||||||
// Assume email
|
// Assume email
|
||||||
newMember = new ThreepidMember(this.state.filterText);
|
newMember = new ThreepidMember(this.state.filterText);
|
||||||
}
|
}
|
||||||
|
@ -734,7 +736,7 @@ export default class InviteDialog extends React.PureComponent {
|
||||||
this.setState({tryingIdentityServer: true});
|
this.setState({tryingIdentityServer: true});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (term.indexOf('@') > 0 && Email.looksValid(term)) {
|
if (term.indexOf('@') > 0 && Email.looksValid(term) && SettingsStore.getValue(UIFeature.IdentityServer)) {
|
||||||
// Start off by suggesting the plain email while we try and resolve it
|
// Start off by suggesting the plain email while we try and resolve it
|
||||||
// to a real account.
|
// to a real account.
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -1037,7 +1039,9 @@ export default class InviteDialog extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
_renderIdentityServerWarning() {
|
_renderIdentityServerWarning() {
|
||||||
if (!this.state.tryingIdentityServer || this.state.canUseIdentityServer) {
|
if (!this.state.tryingIdentityServer || this.state.canUseIdentityServer ||
|
||||||
|
!SettingsStore.getValue(UIFeature.IdentityServer)
|
||||||
|
) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1086,22 +1090,38 @@ export default class InviteDialog extends React.PureComponent {
|
||||||
let buttonText;
|
let buttonText;
|
||||||
let goButtonFn;
|
let goButtonFn;
|
||||||
|
|
||||||
|
const identityServersEnabled = SettingsStore.getValue(UIFeature.IdentityServer);
|
||||||
|
|
||||||
const userId = MatrixClientPeg.get().getUserId();
|
const userId = MatrixClientPeg.get().getUserId();
|
||||||
if (this.props.kind === KIND_DM) {
|
if (this.props.kind === KIND_DM) {
|
||||||
title = _t("Direct Messages");
|
title = _t("Direct Messages");
|
||||||
|
|
||||||
|
if (identityServersEnabled) {
|
||||||
helpText = _t(
|
helpText = _t(
|
||||||
"Start a conversation with someone using their name, username (like <userId/>) or email address.",
|
"Start a conversation with someone using their name, username (like <userId/>) or email address.",
|
||||||
{},
|
{},
|
||||||
{userId: () => {
|
{userId: () => {
|
||||||
return <a href={makeUserPermalink(userId)} rel="noreferrer noopener" target="_blank">{userId}</a>;
|
return (
|
||||||
|
<a href={makeUserPermalink(userId)} rel="noreferrer noopener" target="_blank">{userId}</a>
|
||||||
|
);
|
||||||
}},
|
}},
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
helpText = _t(
|
||||||
|
"Start a conversation with someone using their name or username (like <userId/>).",
|
||||||
|
{},
|
||||||
|
{userId: () => {
|
||||||
|
return (
|
||||||
|
<a href={makeUserPermalink(userId)} rel="noreferrer noopener" target="_blank">{userId}</a>
|
||||||
|
);
|
||||||
|
}},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (CommunityPrototypeStore.instance.getSelectedCommunityId()) {
|
if (CommunityPrototypeStore.instance.getSelectedCommunityId()) {
|
||||||
const communityName = CommunityPrototypeStore.instance.getSelectedCommunityName();
|
const communityName = CommunityPrototypeStore.instance.getSelectedCommunityName();
|
||||||
helpText = _t(
|
const inviteText = _t("This won't invite them to %(communityName)s. " +
|
||||||
"Start a conversation with someone using their name, username (like <userId/>) or email address. " +
|
"To invite someone to %(communityName)s, click <a>here</a>",
|
||||||
"This won't invite them to %(communityName)s. To invite someone to %(communityName)s, click " +
|
|
||||||
"<a>here</a>.",
|
|
||||||
{communityName}, {
|
{communityName}, {
|
||||||
userId: () => {
|
userId: () => {
|
||||||
return (
|
return (
|
||||||
|
@ -1122,13 +1142,19 @@ export default class InviteDialog extends React.PureComponent {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
helpText = <React.Fragment>
|
||||||
|
{ helpText } {inviteText}
|
||||||
|
</React.Fragment>;
|
||||||
}
|
}
|
||||||
buttonText = _t("Go");
|
buttonText = _t("Go");
|
||||||
goButtonFn = this._startDm;
|
goButtonFn = this._startDm;
|
||||||
} else { // KIND_INVITE
|
} else { // KIND_INVITE
|
||||||
title = _t("Invite to this room");
|
title = _t("Invite to this room");
|
||||||
|
|
||||||
|
if (identityServersEnabled) {
|
||||||
helpText = _t(
|
helpText = _t(
|
||||||
"Invite someone using their name, username (like <userId/>), email address or <a>share this room</a>.",
|
"Invite someone using their name, username (like <userId/>), email address or " +
|
||||||
|
"<a>share this room</a>.",
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
userId: () =>
|
userId: () =>
|
||||||
|
@ -1137,6 +1163,19 @@ export default class InviteDialog extends React.PureComponent {
|
||||||
<a href={makeRoomPermalink(this.props.roomId)} rel="noreferrer noopener" target="_blank">{sub}</a>,
|
<a href={makeRoomPermalink(this.props.roomId)} rel="noreferrer noopener" target="_blank">{sub}</a>,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
helpText = _t(
|
||||||
|
"Invite someone using their name, username (like <userId/>) or <a>share this room</a>.",
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
userId: () =>
|
||||||
|
<a href={makeUserPermalink(userId)} rel="noreferrer noopener" target="_blank">{userId}</a>,
|
||||||
|
a: (sub) =>
|
||||||
|
<a href={makeRoomPermalink(this.props.roomId)} rel="noreferrer noopener" target="_blank">{sub}</a>,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
buttonText = _t("Invite");
|
buttonText = _t("Invite");
|
||||||
goButtonFn = this._inviteUsers;
|
goButtonFn = this._inviteUsers;
|
||||||
}
|
}
|
||||||
|
|
|
@ -394,14 +394,21 @@ export default class GeneralUserSettingsTab extends React.Component {
|
||||||
</>;
|
</>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let discoverySection;
|
||||||
|
if (SettingsStore.getValue(UIFeature.IdentityServer)) {
|
||||||
|
discoverySection = <>
|
||||||
|
<div className="mx_SettingsTab_heading">{discoWarning} {_t("Discovery")}</div>
|
||||||
|
{this._renderDiscoverySection()}
|
||||||
|
</>;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx_SettingsTab">
|
<div className="mx_SettingsTab">
|
||||||
<div className="mx_SettingsTab_heading">{_t("General")}</div>
|
<div className="mx_SettingsTab_heading">{_t("General")}</div>
|
||||||
{this._renderProfileSection()}
|
{this._renderProfileSection()}
|
||||||
{this._renderAccountSection()}
|
{this._renderAccountSection()}
|
||||||
{this._renderLanguageSection()}
|
{this._renderLanguageSection()}
|
||||||
<div className="mx_SettingsTab_heading">{discoWarning} {_t("Discovery")}</div>
|
{ discoverySection }
|
||||||
{this._renderDiscoverySection()}
|
|
||||||
{this._renderIntegrationManagerSection() /* Has its own title */}
|
{this._renderIntegrationManagerSection() /* Has its own title */}
|
||||||
{ accountManagementSection }
|
{ accountManagementSection }
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -833,8 +833,8 @@
|
||||||
"Deactivating your account is a permanent action - be careful!": "Deactivating your account is a permanent action - be careful!",
|
"Deactivating your account is a permanent action - be careful!": "Deactivating your account is a permanent action - be careful!",
|
||||||
"Deactivate Account": "Deactivate Account",
|
"Deactivate Account": "Deactivate Account",
|
||||||
"Deactivate account": "Deactivate account",
|
"Deactivate account": "Deactivate account",
|
||||||
"General": "General",
|
|
||||||
"Discovery": "Discovery",
|
"Discovery": "Discovery",
|
||||||
|
"General": "General",
|
||||||
"Legal": "Legal",
|
"Legal": "Legal",
|
||||||
"Credits": "Credits",
|
"Credits": "Credits",
|
||||||
"For help with using %(brand)s, click <a>here</a>.": "For help with using %(brand)s, click <a>here</a>.",
|
"For help with using %(brand)s, click <a>here</a>.": "For help with using %(brand)s, click <a>here</a>.",
|
||||||
|
@ -1732,9 +1732,11 @@
|
||||||
"Recently Direct Messaged": "Recently Direct Messaged",
|
"Recently Direct Messaged": "Recently Direct Messaged",
|
||||||
"Direct Messages": "Direct Messages",
|
"Direct Messages": "Direct Messages",
|
||||||
"Start a conversation with someone using their name, username (like <userId/>) or email address.": "Start a conversation with someone using their name, username (like <userId/>) or email address.",
|
"Start a conversation with someone using their name, username (like <userId/>) or email address.": "Start a conversation with someone using their name, username (like <userId/>) or email address.",
|
||||||
"Start a conversation with someone using their name, username (like <userId/>) or email address. This won't invite them to %(communityName)s. To invite someone to %(communityName)s, click <a>here</a>.": "Start a conversation with someone using their name, username (like <userId/>) or email address. This won't invite them to %(communityName)s. To invite someone to %(communityName)s, click <a>here</a>.",
|
"Start a conversation with someone using their name or username (like <userId/>).": "Start a conversation with someone using their name or username (like <userId/>).",
|
||||||
|
"This won't invite them to %(communityName)s. To invite someone to %(communityName)s, click <a>here</a>": "This won't invite them to %(communityName)s. To invite someone to %(communityName)s, click <a>here</a>",
|
||||||
"Go": "Go",
|
"Go": "Go",
|
||||||
"Invite someone using their name, username (like <userId/>), email address or <a>share this room</a>.": "Invite someone using their name, username (like <userId/>), email address or <a>share this room</a>.",
|
"Invite someone using their name, username (like <userId/>), email address or <a>share this room</a>.": "Invite someone using their name, username (like <userId/>), email address or <a>share this room</a>.",
|
||||||
|
"Invite someone using their name, username (like <userId/>) or <a>share this room</a>.": "Invite someone using their name, username (like <userId/>) or <a>share this room</a>.",
|
||||||
"a new master key signature": "a new master key signature",
|
"a new master key signature": "a new master key signature",
|
||||||
"a new cross-signing key signature": "a new cross-signing key signature",
|
"a new cross-signing key signature": "a new cross-signing key signature",
|
||||||
"a device cross-signing signature": "a device cross-signing signature",
|
"a device cross-signing signature": "a device cross-signing signature",
|
||||||
|
|
|
@ -651,4 +651,8 @@ export const SETTINGS: {[setting: string]: ISetting} = {
|
||||||
supportedLevels: LEVELS_UI_FEATURE,
|
supportedLevels: LEVELS_UI_FEATURE,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
[UIFeature.IdentityServer]: {
|
||||||
|
supportedLevels: LEVELS_UI_FEATURE,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -25,4 +25,5 @@ export enum UIFeature {
|
||||||
Deactivate = "UIFeature.deactivate",
|
Deactivate = "UIFeature.deactivate",
|
||||||
ShareQRCode = "UIFeature.shareQrCode",
|
ShareQRCode = "UIFeature.shareQrCode",
|
||||||
ShareSocial = "UIFeature.shareSocial",
|
ShareSocial = "UIFeature.shareSocial",
|
||||||
|
IdentityServer = "UIFeature.identityServer",
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue