Merge pull request #5785 from matrix-org/gsouquet-failed-invites
commit
356e4bc6fc
|
@ -673,7 +673,7 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
||||||
console.error(err);
|
console.error(err);
|
||||||
this.setState({
|
this.setState({
|
||||||
busy: false,
|
busy: false,
|
||||||
errorText: _t("We couldn't create your DM. Please check the users you want to invite and try again."),
|
errorText: _t("We couldn't create your DM."),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -886,19 +886,21 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
||||||
};
|
};
|
||||||
|
|
||||||
_toggleMember = (member: Member) => {
|
_toggleMember = (member: Member) => {
|
||||||
let filterText = this.state.filterText;
|
if (!this.state.busy) {
|
||||||
const targets = this.state.targets.map(t => t); // cheap clone for mutation
|
let filterText = this.state.filterText;
|
||||||
const idx = targets.indexOf(member);
|
const targets = this.state.targets.map(t => t); // cheap clone for mutation
|
||||||
if (idx >= 0) {
|
const idx = targets.indexOf(member);
|
||||||
targets.splice(idx, 1);
|
if (idx >= 0) {
|
||||||
} else {
|
targets.splice(idx, 1);
|
||||||
targets.push(member);
|
} else {
|
||||||
filterText = ""; // clear the filter when the user accepts a suggestion
|
targets.push(member);
|
||||||
}
|
filterText = ""; // clear the filter when the user accepts a suggestion
|
||||||
this.setState({targets, filterText});
|
}
|
||||||
|
this.setState({targets, filterText});
|
||||||
|
|
||||||
if (this._editorRef && this._editorRef.current) {
|
if (this._editorRef && this._editorRef.current) {
|
||||||
this._editorRef.current.focus();
|
this._editorRef.current.focus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2187,7 +2187,7 @@
|
||||||
"Click the button below to confirm your identity.": "Click the button below to confirm your identity.",
|
"Click the button below to confirm your identity.": "Click the button below to confirm your identity.",
|
||||||
"Invite by email": "Invite by email",
|
"Invite by email": "Invite by email",
|
||||||
"Failed to invite the following users to chat: %(csvUsers)s": "Failed to invite the following users to chat: %(csvUsers)s",
|
"Failed to invite the following users to chat: %(csvUsers)s": "Failed to invite the following users to chat: %(csvUsers)s",
|
||||||
"We couldn't create your DM. Please check the users you want to invite and try again.": "We couldn't create your DM. Please check the users you want to invite and try again.",
|
"We couldn't create your DM.": "We couldn't create your DM.",
|
||||||
"Something went wrong trying to invite the users.": "Something went wrong trying to invite the users.",
|
"Something went wrong trying to invite the users.": "Something went wrong trying to invite the users.",
|
||||||
"We couldn't invite those users. Please check the users you want to invite and try again.": "We couldn't invite those users. Please check the users you want to invite and try again.",
|
"We couldn't invite those users. Please check the users you want to invite and try again.": "We couldn't invite those users. Please check the users you want to invite and try again.",
|
||||||
"A call can only be transferred to a single user.": "A call can only be transferred to a single user.",
|
"A call can only be transferred to a single user.": "A call can only be transferred to a single user.",
|
||||||
|
|
|
@ -111,17 +111,10 @@ export default class MultiInviter {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ignoreProfile && SettingsStore.getValue("promptBeforeInviteUnknownUsers", this.roomId)) {
|
if (!ignoreProfile && SettingsStore.getValue("promptBeforeInviteUnknownUsers", this.roomId)) {
|
||||||
try {
|
const profile = await MatrixClientPeg.get().getProfileInfo(addr);
|
||||||
const profile = await MatrixClientPeg.get().getProfileInfo(addr);
|
if (!profile) {
|
||||||
if (!profile) {
|
// noinspection ExceptionCaughtLocallyJS
|
||||||
// noinspection ExceptionCaughtLocallyJS
|
throw new Error("User has no profile");
|
||||||
throw new Error("User has no profile");
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
throw {
|
|
||||||
errcode: "RIOT.USER_NOT_FOUND",
|
|
||||||
error: "User does not have a profile or does not exist."
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +164,7 @@ export default class MultiInviter {
|
||||||
this._doInvite(address, ignoreProfile).then(resolve, reject);
|
this._doInvite(address, ignoreProfile).then(resolve, reject);
|
||||||
}, 5000);
|
}, 5000);
|
||||||
return;
|
return;
|
||||||
} else if (['M_NOT_FOUND', 'M_USER_NOT_FOUND', 'RIOT.USER_NOT_FOUND'].includes(err.errcode)) {
|
} else if (['M_NOT_FOUND', 'M_USER_NOT_FOUND'].includes(err.errcode)) {
|
||||||
errorText = _t("User %(user_id)s does not exist", {user_id: address});
|
errorText = _t("User %(user_id)s does not exist", {user_id: address});
|
||||||
} else if (err.errcode === 'M_PROFILE_UNDISCLOSED') {
|
} else if (err.errcode === 'M_PROFILE_UNDISCLOSED') {
|
||||||
errorText = _t("User %(user_id)s may or may not exist", {user_id: address});
|
errorText = _t("User %(user_id)s may or may not exist", {user_id: address});
|
||||||
|
@ -212,7 +205,7 @@ export default class MultiInviter {
|
||||||
if (Object.keys(this.errors).length > 0 && !this.groupId) {
|
if (Object.keys(this.errors).length > 0 && !this.groupId) {
|
||||||
// There were problems inviting some people - see if we can invite them
|
// There were problems inviting some people - see if we can invite them
|
||||||
// without caring if they exist or not.
|
// without caring if they exist or not.
|
||||||
const unknownProfileErrors = ['M_NOT_FOUND', 'M_USER_NOT_FOUND', 'M_PROFILE_UNDISCLOSED', 'M_PROFILE_NOT_FOUND', 'RIOT.USER_NOT_FOUND'];
|
const unknownProfileErrors = ['M_NOT_FOUND', 'M_USER_NOT_FOUND', 'M_PROFILE_UNDISCLOSED', 'M_PROFILE_NOT_FOUND'];
|
||||||
const unknownProfileUsers = Object.keys(this.errors).filter(a => unknownProfileErrors.includes(this.errors[a].errcode));
|
const unknownProfileUsers = Object.keys(this.errors).filter(a => unknownProfileErrors.includes(this.errors[a].errcode));
|
||||||
|
|
||||||
if (unknownProfileUsers.length > 0) {
|
if (unknownProfileUsers.length > 0) {
|
||||||
|
@ -228,7 +221,7 @@ export default class MultiInviter {
|
||||||
|
|
||||||
const AskInviteAnywayDialog = sdk.getComponent("dialogs.AskInviteAnywayDialog");
|
const AskInviteAnywayDialog = sdk.getComponent("dialogs.AskInviteAnywayDialog");
|
||||||
console.log("Showing failed to invite dialog...");
|
console.log("Showing failed to invite dialog...");
|
||||||
Modal.createTrackedDialog('Failed to invite the following users to the room', '', AskInviteAnywayDialog, {
|
Modal.createTrackedDialog('Failed to invite', '', AskInviteAnywayDialog, {
|
||||||
unknownProfileUsers: unknownProfileUsers.map(u => {return {userId: u, errorText: this.errors[u].errorText};}),
|
unknownProfileUsers: unknownProfileUsers.map(u => {return {userId: u, errorText: this.errors[u].errorText};}),
|
||||||
onInviteAnyways: () => inviteUnknowns(),
|
onInviteAnyways: () => inviteUnknowns(),
|
||||||
onGiveUp: () => {
|
onGiveUp: () => {
|
||||||
|
|
Loading…
Reference in New Issue