Make invite work without an IS

Also fix it so you can't try to invite a room ID to a room
This commit is contained in:
David Baker 2019-08-07 11:41:00 +01:00
parent 366f7e277a
commit bcf53c6e33
2 changed files with 18 additions and 3 deletions

View file

@ -42,11 +42,17 @@ function inviteMultipleToRoom(roomId, addrs) {
export function showStartChatInviteDialog() {
const AddressPickerDialog = sdk.getComponent("dialogs.AddressPickerDialog");
const validAddressTypes = ['mx-user-id'];
if (MatrixClientPeg.get().getIdentityServerUrl()) {
validAddressTypes.push('email');
}
Modal.createTrackedDialog('Start a chat', '', AddressPickerDialog, {
title: _t('Start a chat'),
description: _t("Who would you like to communicate with?"),
placeholder: _t("Email, name or Matrix ID"),
validAddressTypes: ['mx-user-id', 'email'],
validAddressTypes,
button: _t("Start Chat"),
onFinished: _onStartChatFinished,
});
@ -54,11 +60,18 @@ export function showStartChatInviteDialog() {
export function showRoomInviteDialog(roomId) {
const AddressPickerDialog = sdk.getComponent("dialogs.AddressPickerDialog");
const validAddressTypes = ['mx-user-id'];
if (MatrixClientPeg.get().getIdentityServerUrl()) {
validAddressTypes.push('email');
}
Modal.createTrackedDialog('Chat Invite', '', AddressPickerDialog, {
title: _t('Invite new room members'),
description: _t('Who would you like to add to this room?'),
button: _t('Send Invites'),
placeholder: _t("Email, name or Matrix ID"),
validAddressTypes,
onFinished: (shouldInvite, addrs) => {
_onRoomInviteFinished(roomId, shouldInvite, addrs);
},