Ensure errors when creating a DM are raised to the user

Fixes https://github.com/vector-im/riot-web/issues/12186

Note: this will still result in an empty room being created, but that's a Synapse issue and not something we can solve.
pull/21833/head
Travis Ralston 2020-02-27 17:10:31 -07:00
parent 5325b5677f
commit 46a6af0ad1
3 changed files with 7 additions and 2 deletions

View File

@ -72,7 +72,7 @@ export default createReactClass({
<button onClick={this._onInviteNeverWarnClicked}> <button onClick={this._onInviteNeverWarnClicked}>
{ _t('Invite anyway and never warn me again') } { _t('Invite anyway and never warn me again') }
</button> </button>
<button onClick={this._onInviteClicked} autoFocus="true"> <button onClick={this._onInviteClicked} autoFocus={true}>
{ _t('Invite anyway') } { _t('Invite anyway') }
</button> </button>
</div> </div>

View File

@ -564,7 +564,7 @@ export default class InviteDialog extends React.PureComponent {
return; return;
} }
const createRoomOptions = {}; const createRoomOptions = {inlineErrors: true};
if (SettingsStore.isFeatureEnabled("feature_cross_signing")) { if (SettingsStore.isFeatureEnabled("feature_cross_signing")) {
// Check whether all users have uploaded device keys before. // Check whether all users have uploaded device keys before.

View File

@ -37,6 +37,8 @@ import SettingsStore from "./settings/SettingsStore";
* Default: True * Default: True
* @param {bool=} opts.encryption Whether to enable encryption. * @param {bool=} opts.encryption Whether to enable encryption.
* Default: False * Default: False
* @param {bool=} opts.inlineErrors True to raise errors off the promise instead of resolving to null.
* Default: False
* *
* @returns {Promise} which resolves to the room id, or null if the * @returns {Promise} which resolves to the room id, or null if the
* action was aborted or failed. * action was aborted or failed.
@ -140,6 +142,9 @@ export default function createRoom(opts) {
} }
return roomId; return roomId;
}, function(err) { }, function(err) {
// Raise the error if the caller requested that we do so.
if (opts.inlineErrors) throw err;
// We also failed to join the room (this sets joining to false in RoomViewStore) // We also failed to join the room (this sets joining to false in RoomViewStore)
dis.dispatch({ dis.dispatch({
action: 'join_room_error', action: 'join_room_error',