mirror of https://github.com/vector-im/riot-web
Merge pull request #3408 from matrix-org/t3chguy/community_member_invite_IS_text
Fix identity server text in AddressPickerDialogpull/21833/head
commit
7afd80e55b
|
@ -43,11 +43,6 @@ function inviteMultipleToRoom(roomId, addrs) {
|
||||||
export function showStartChatInviteDialog() {
|
export function showStartChatInviteDialog() {
|
||||||
const AddressPickerDialog = sdk.getComponent("dialogs.AddressPickerDialog");
|
const AddressPickerDialog = sdk.getComponent("dialogs.AddressPickerDialog");
|
||||||
|
|
||||||
const validAddressTypes = ['mx-user-id'];
|
|
||||||
if (MatrixClientPeg.get().getIdentityServerUrl()) {
|
|
||||||
validAddressTypes.push('email');
|
|
||||||
}
|
|
||||||
|
|
||||||
Modal.createTrackedDialog('Start a chat', '', AddressPickerDialog, {
|
Modal.createTrackedDialog('Start a chat', '', AddressPickerDialog, {
|
||||||
title: _t('Start a chat'),
|
title: _t('Start a chat'),
|
||||||
description: _t("Who would you like to communicate with?"),
|
description: _t("Who would you like to communicate with?"),
|
||||||
|
@ -59,7 +54,7 @@ export function showStartChatInviteDialog() {
|
||||||
}
|
}
|
||||||
return _t("Name or Matrix ID");
|
return _t("Name or Matrix ID");
|
||||||
},
|
},
|
||||||
validAddressTypes,
|
validAddressTypes: ['mx-user-id', 'email'],
|
||||||
button: _t("Start Chat"),
|
button: _t("Start Chat"),
|
||||||
onFinished: _onStartDmFinished,
|
onFinished: _onStartDmFinished,
|
||||||
}, /*className=*/null, /*isPriority=*/false, /*isStatic=*/true);
|
}, /*className=*/null, /*isPriority=*/false, /*isStatic=*/true);
|
||||||
|
@ -68,11 +63,6 @@ export function showStartChatInviteDialog() {
|
||||||
export function showRoomInviteDialog(roomId) {
|
export function showRoomInviteDialog(roomId) {
|
||||||
const AddressPickerDialog = sdk.getComponent("dialogs.AddressPickerDialog");
|
const AddressPickerDialog = sdk.getComponent("dialogs.AddressPickerDialog");
|
||||||
|
|
||||||
const validAddressTypes = ['mx-user-id'];
|
|
||||||
if (MatrixClientPeg.get().getIdentityServerUrl()) {
|
|
||||||
validAddressTypes.push('email');
|
|
||||||
}
|
|
||||||
|
|
||||||
Modal.createTrackedDialog('Chat Invite', '', AddressPickerDialog, {
|
Modal.createTrackedDialog('Chat Invite', '', AddressPickerDialog, {
|
||||||
title: _t('Invite new room members'),
|
title: _t('Invite new room members'),
|
||||||
button: _t('Send Invites'),
|
button: _t('Send Invites'),
|
||||||
|
@ -84,7 +74,7 @@ export function showRoomInviteDialog(roomId) {
|
||||||
}
|
}
|
||||||
return _t("Name or Matrix ID");
|
return _t("Name or Matrix ID");
|
||||||
},
|
},
|
||||||
validAddressTypes,
|
validAddressTypes: ['mx-user-id', 'email'],
|
||||||
onFinished: (shouldInvite, addrs) => {
|
onFinished: (shouldInvite, addrs) => {
|
||||||
_onRoomInviteFinished(roomId, shouldInvite, addrs);
|
_onRoomInviteFinished(roomId, shouldInvite, addrs);
|
||||||
},
|
},
|
||||||
|
|
|
@ -77,6 +77,12 @@ module.exports = createReactClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
|
let validAddressTypes = this.props.validAddressTypes;
|
||||||
|
// Remove email from validAddressTypes if no IS is configured. It may be added at a later stage by the user
|
||||||
|
if (!MatrixClientPeg.get().getIdentityServerUrl() && validAddressTypes.includes("email")) {
|
||||||
|
validAddressTypes = validAddressTypes.splice(validAddressTypes.indexOf("email"), 1);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
// Whether to show an error message because of an invalid address
|
// Whether to show an error message because of an invalid address
|
||||||
invalidAddressError: false,
|
invalidAddressError: false,
|
||||||
|
@ -95,8 +101,8 @@ module.exports = createReactClass({
|
||||||
// auto-completion results for the current search query.
|
// auto-completion results for the current search query.
|
||||||
suggestedList: [],
|
suggestedList: [],
|
||||||
// List of address types initialised from props, but may change while the
|
// List of address types initialised from props, but may change while the
|
||||||
// dialog is open.
|
// dialog is open and represents the supported list of address types at this time.
|
||||||
validAddressTypes: this.props.validAddressTypes,
|
validAddressTypes,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -678,7 +684,9 @@ module.exports = createReactClass({
|
||||||
}
|
}
|
||||||
|
|
||||||
let identityServer;
|
let identityServer;
|
||||||
if (this.props.pickerType === 'user' && !this.state.validAddressTypes.includes('email')) {
|
// If picker cannot currently accept e-mail but should be able to
|
||||||
|
if (this.props.pickerType === 'user' && !this.state.validAddressTypes.includes('email')
|
||||||
|
&& this.props.validAddressTypes.includes('email')) {
|
||||||
const defaultIdentityServerUrl = getDefaultIdentityServerUrl();
|
const defaultIdentityServerUrl = getDefaultIdentityServerUrl();
|
||||||
if (defaultIdentityServerUrl) {
|
if (defaultIdentityServerUrl) {
|
||||||
identityServer = <div className="mx_AddressPickerDialog_identityServer">{_t(
|
identityServer = <div className="mx_AddressPickerDialog_identityServer">{_t(
|
||||||
|
|
Loading…
Reference in New Issue