Move the rest of the IS/email supported logic to AddressPickerDialog
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
194cd0a460
commit
043a8d35e6
2 changed files with 12 additions and 7 deletions
|
@ -43,10 +43,7 @@ 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'];
|
const validAddressTypes = ['mx-user-id', 'email'];
|
||||||
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'),
|
||||||
|
|
|
@ -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.props.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…
Add table
Add a link
Reference in a new issue