mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-15 20:54:59 +08:00
s/.done(/.then(/ since modern es6 track unhandled promise exceptions
This commit is contained in:
parent
0a21957b2c
commit
09a8fec261
@ -524,7 +524,7 @@ export function logout() {
|
||||
console.log("Failed to call logout API: token will not be invalidated");
|
||||
onLoggedOut();
|
||||
},
|
||||
).done();
|
||||
).then();
|
||||
}
|
||||
|
||||
export function softLogout() {
|
||||
@ -608,7 +608,7 @@ export function onLoggedOut() {
|
||||
// that can occur when components try to use a null client.
|
||||
dis.dispatch({action: 'on_logged_out'}, true);
|
||||
stopMatrixClient();
|
||||
_clearStorage().done();
|
||||
_clearStorage().then();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -198,7 +198,7 @@ const Notifier = {
|
||||
|
||||
if (enable) {
|
||||
// Attempt to get permission from user
|
||||
plaf.requestNotificationPermission().done((result) => {
|
||||
plaf.requestNotificationPermission().then((result) => {
|
||||
if (result !== 'granted') {
|
||||
// The permission request was dismissed or denied
|
||||
// TODO: Support alternative branding in messaging
|
||||
|
@ -35,7 +35,7 @@ module.exports = {
|
||||
},
|
||||
resend: function(event) {
|
||||
const room = MatrixClientPeg.get().getRoom(event.getRoomId());
|
||||
MatrixClientPeg.get().resendEvent(event, room).done(function(res) {
|
||||
MatrixClientPeg.get().resendEvent(event, room).then(function(res) {
|
||||
dis.dispatch({
|
||||
action: 'message_sent',
|
||||
event: event,
|
||||
|
@ -279,7 +279,7 @@ function inviteUser(event, roomId, userId) {
|
||||
}
|
||||
}
|
||||
|
||||
client.invite(roomId, userId).done(function() {
|
||||
client.invite(roomId, userId).then(function() {
|
||||
sendResponse(event, {
|
||||
success: true,
|
||||
});
|
||||
@ -398,7 +398,7 @@ function setPlumbingState(event, roomId, status) {
|
||||
sendError(event, _t('You need to be logged in.'));
|
||||
return;
|
||||
}
|
||||
client.sendStateEvent(roomId, "m.room.plumbing", { status: status }).done(() => {
|
||||
client.sendStateEvent(roomId, "m.room.plumbing", { status: status }).then(() => {
|
||||
sendResponse(event, {
|
||||
success: true,
|
||||
});
|
||||
@ -414,7 +414,7 @@ function setBotOptions(event, roomId, userId) {
|
||||
sendError(event, _t('You need to be logged in.'));
|
||||
return;
|
||||
}
|
||||
client.sendStateEvent(roomId, "m.room.bot.options", event.data.content, "_" + userId).done(() => {
|
||||
client.sendStateEvent(roomId, "m.room.bot.options", event.data.content, "_" + userId).then(() => {
|
||||
sendResponse(event, {
|
||||
success: true,
|
||||
});
|
||||
@ -444,7 +444,7 @@ function setBotPower(event, roomId, userId, level) {
|
||||
},
|
||||
);
|
||||
|
||||
client.setPowerLevel(roomId, userId, level, powerEvent).done(() => {
|
||||
client.setPowerLevel(roomId, userId, level, powerEvent).then(() => {
|
||||
sendResponse(event, {
|
||||
success: true,
|
||||
});
|
||||
|
@ -639,7 +639,7 @@ export default createReactClass({
|
||||
title: _t('Error'),
|
||||
description: _t('Failed to upload image'),
|
||||
});
|
||||
}).done();
|
||||
}).then();
|
||||
},
|
||||
|
||||
_onJoinableChange: function(ev) {
|
||||
@ -678,7 +678,7 @@ export default createReactClass({
|
||||
this.setState({
|
||||
avatarChanged: false,
|
||||
});
|
||||
}).done();
|
||||
}).then();
|
||||
},
|
||||
|
||||
_saveGroup: async function() {
|
||||
|
@ -121,7 +121,7 @@ export default createReactClass({
|
||||
this.setState({
|
||||
errorText: msg,
|
||||
});
|
||||
}).done();
|
||||
}).then();
|
||||
|
||||
this._intervalId = null;
|
||||
if (this.props.poll) {
|
||||
|
@ -541,7 +541,7 @@ export default createReactClass({
|
||||
const Loader = sdk.getComponent("elements.Spinner");
|
||||
const modal = Modal.createDialog(Loader, null, 'mx_Dialog_spinner');
|
||||
|
||||
MatrixClientPeg.get().leave(payload.room_id).done(() => {
|
||||
MatrixClientPeg.get().leave(payload.room_id).then(() => {
|
||||
modal.close();
|
||||
if (this.state.currentRoomId === payload.room_id) {
|
||||
dis.dispatch({action: 'view_next_room'});
|
||||
@ -862,7 +862,7 @@ export default createReactClass({
|
||||
waitFor = this.firstSyncPromise.promise;
|
||||
}
|
||||
|
||||
waitFor.done(() => {
|
||||
waitFor.then(() => {
|
||||
let presentedId = roomInfo.room_alias || roomInfo.room_id;
|
||||
const room = MatrixClientPeg.get().getRoom(roomInfo.room_id);
|
||||
if (room) {
|
||||
@ -974,7 +974,7 @@ export default createReactClass({
|
||||
|
||||
const [shouldCreate, createOpts] = await modal.finished;
|
||||
if (shouldCreate) {
|
||||
createRoom({createOpts}).done();
|
||||
createRoom({createOpts}).then();
|
||||
}
|
||||
},
|
||||
|
||||
@ -1750,7 +1750,7 @@ export default createReactClass({
|
||||
return;
|
||||
}
|
||||
|
||||
cli.sendEvent(roomId, event.getType(), event.getContent()).done(() => {
|
||||
cli.sendEvent(roomId, event.getType(), event.getContent()).then(() => {
|
||||
dis.dispatch({action: 'message_sent'});
|
||||
}, (err) => {
|
||||
dis.dispatch({action: 'message_send_failed'});
|
||||
|
@ -47,7 +47,7 @@ export default createReactClass({
|
||||
},
|
||||
|
||||
_fetch: function() {
|
||||
this.context.matrixClient.getJoinedGroups().done((result) => {
|
||||
this.context.matrixClient.getJoinedGroups().then((result) => {
|
||||
this.setState({groups: result.groups, error: null});
|
||||
}, (err) => {
|
||||
if (err.errcode === 'M_GUEST_ACCESS_FORBIDDEN') {
|
||||
|
@ -89,7 +89,7 @@ module.exports = createReactClass({
|
||||
this.setState({protocolsLoading: false});
|
||||
return;
|
||||
}
|
||||
MatrixClientPeg.get().getThirdpartyProtocols().done((response) => {
|
||||
MatrixClientPeg.get().getThirdpartyProtocols().then((response) => {
|
||||
this.protocols = response;
|
||||
this.setState({protocolsLoading: false});
|
||||
}, (err) => {
|
||||
@ -135,7 +135,7 @@ module.exports = createReactClass({
|
||||
publicRooms: [],
|
||||
loading: true,
|
||||
});
|
||||
this.getMoreRooms().done();
|
||||
this.getMoreRooms().then();
|
||||
},
|
||||
|
||||
getMoreRooms: function() {
|
||||
@ -246,7 +246,7 @@ module.exports = createReactClass({
|
||||
if (!alias) return;
|
||||
step = _t('delete the alias.');
|
||||
return MatrixClientPeg.get().deleteAlias(alias);
|
||||
}).done(() => {
|
||||
}).then(() => {
|
||||
modal.close();
|
||||
this.refreshRoomList();
|
||||
}, (err) => {
|
||||
@ -348,7 +348,7 @@ module.exports = createReactClass({
|
||||
});
|
||||
return;
|
||||
}
|
||||
MatrixClientPeg.get().getThirdpartyLocation(protocolName, fields).done((resp) => {
|
||||
MatrixClientPeg.get().getThirdpartyLocation(protocolName, fields).then((resp) => {
|
||||
if (resp.length > 0 && resp[0].alias) {
|
||||
this.showRoomAlias(resp[0].alias, true);
|
||||
} else {
|
||||
|
@ -1101,7 +1101,7 @@ module.exports = createReactClass({
|
||||
}
|
||||
|
||||
ContentMessages.sharedInstance().sendStickerContentToRoom(url, this.state.room.roomId, info, text, MatrixClientPeg.get())
|
||||
.done(undefined, (error) => {
|
||||
.then(undefined, (error) => {
|
||||
if (error.name === "UnknownDeviceError") {
|
||||
// Let the staus bar handle this
|
||||
return;
|
||||
@ -1145,7 +1145,7 @@ module.exports = createReactClass({
|
||||
filter: filter,
|
||||
term: term,
|
||||
});
|
||||
this._handleSearchResult(searchPromise).done();
|
||||
this._handleSearchResult(searchPromise).then();
|
||||
},
|
||||
|
||||
_handleSearchResult: function(searchPromise) {
|
||||
@ -1316,7 +1316,7 @@ module.exports = createReactClass({
|
||||
},
|
||||
|
||||
onForgetClick: function() {
|
||||
MatrixClientPeg.get().forget(this.state.room.roomId).done(function() {
|
||||
MatrixClientPeg.get().forget(this.state.room.roomId).then(function() {
|
||||
dis.dispatch({ action: 'view_next_room' });
|
||||
}, function(err) {
|
||||
const errCode = err.errcode || _t("unknown error code");
|
||||
@ -1333,7 +1333,7 @@ module.exports = createReactClass({
|
||||
this.setState({
|
||||
rejecting: true,
|
||||
});
|
||||
MatrixClientPeg.get().leave(this.state.roomId).done(function() {
|
||||
MatrixClientPeg.get().leave(this.state.roomId).then(function() {
|
||||
dis.dispatch({ action: 'view_next_room' });
|
||||
self.setState({
|
||||
rejecting: false,
|
||||
|
@ -462,7 +462,7 @@ const TimelinePanel = createReactClass({
|
||||
// timeline window.
|
||||
//
|
||||
// see https://github.com/vector-im/vector-web/issues/1035
|
||||
this._timelineWindow.paginate(EventTimeline.FORWARDS, 1, false).done(() => {
|
||||
this._timelineWindow.paginate(EventTimeline.FORWARDS, 1, false).then(() => {
|
||||
if (this.unmounted) { return; }
|
||||
|
||||
const { events, liveEvents } = this._getEvents();
|
||||
@ -1088,7 +1088,7 @@ const TimelinePanel = createReactClass({
|
||||
prom = prom.then(onLoaded, onError);
|
||||
}
|
||||
|
||||
prom.done();
|
||||
prom.then();
|
||||
},
|
||||
|
||||
// handle the completion of a timeline load or localEchoUpdate, by
|
||||
|
@ -105,7 +105,7 @@ module.exports = createReactClass({
|
||||
phase: PHASE_SENDING_EMAIL,
|
||||
});
|
||||
this.reset = new PasswordReset(this.props.serverConfig.hsUrl, this.props.serverConfig.isUrl);
|
||||
this.reset.resetPassword(email, password).done(() => {
|
||||
this.reset.resetPassword(email, password).then(() => {
|
||||
this.setState({
|
||||
phase: PHASE_EMAIL_SENT,
|
||||
});
|
||||
|
@ -253,7 +253,7 @@ module.exports = createReactClass({
|
||||
this.setState({
|
||||
busy: false,
|
||||
});
|
||||
}).done();
|
||||
}).then();
|
||||
},
|
||||
|
||||
onUsernameChanged: function(username) {
|
||||
@ -424,7 +424,7 @@ module.exports = createReactClass({
|
||||
this.setState({
|
||||
busy: false,
|
||||
});
|
||||
}).done();
|
||||
}).then();
|
||||
},
|
||||
|
||||
_isSupportedFlow: function(flow) {
|
||||
|
@ -43,7 +43,7 @@ module.exports = createReactClass({
|
||||
const cli = MatrixClientPeg.get();
|
||||
this.setState({busy: true});
|
||||
const self = this;
|
||||
cli.getProfileInfo(cli.credentials.userId).done(function(result) {
|
||||
cli.getProfileInfo(cli.credentials.userId).then(function(result) {
|
||||
self.setState({
|
||||
avatarUrl: MatrixClientPeg.get().mxcUrlToHttp(result.avatar_url),
|
||||
busy: false,
|
||||
|
@ -371,7 +371,7 @@ module.exports = createReactClass({
|
||||
if (pushers[i].kind === 'email') {
|
||||
const emailPusher = pushers[i];
|
||||
emailPusher.data = { brand: this.props.brand };
|
||||
matrixClient.setPusher(emailPusher).done(() => {
|
||||
matrixClient.setPusher(emailPusher).then(() => {
|
||||
console.log("Set email branding to " + this.props.brand);
|
||||
}, (error) => {
|
||||
console.error("Couldn't set email branding: " + error);
|
||||
|
@ -441,7 +441,7 @@ export const MsisdnAuthEntry = createReactClass({
|
||||
this.props.fail(e);
|
||||
}).finally(() => {
|
||||
this.setState({requestingToken: false});
|
||||
}).done();
|
||||
}).then();
|
||||
},
|
||||
|
||||
/*
|
||||
|
@ -161,7 +161,7 @@ module.exports = createReactClass({
|
||||
|
||||
_onClickForget: function() {
|
||||
// FIXME: duplicated with RoomSettings (and dead code in RoomView)
|
||||
MatrixClientPeg.get().forget(this.props.room.roomId).done(() => {
|
||||
MatrixClientPeg.get().forget(this.props.room.roomId).then(() => {
|
||||
// Switch to another room view if we're currently viewing the
|
||||
// historical room
|
||||
if (RoomViewStore.getRoomId() === this.props.room.roomId) {
|
||||
@ -191,7 +191,7 @@ module.exports = createReactClass({
|
||||
this.setState({
|
||||
roomNotifState: newState,
|
||||
});
|
||||
RoomNotifs.setRoomNotifsState(roomId, newState).done(() => {
|
||||
RoomNotifs.setRoomNotifsState(roomId, newState).then(() => {
|
||||
// delay slightly so that the user can see their state change
|
||||
// before closing the menu
|
||||
return sleep(500).then(() => {
|
||||
|
@ -267,7 +267,7 @@ module.exports = createReactClass({
|
||||
this.setState({
|
||||
searchError: err.errcode ? err.message : _t('Something went wrong!'),
|
||||
});
|
||||
}).done(() => {
|
||||
}).then(() => {
|
||||
this.setState({
|
||||
busy: false,
|
||||
});
|
||||
@ -380,7 +380,7 @@ module.exports = createReactClass({
|
||||
// Do a local search immediately
|
||||
this._doLocalSearch(query);
|
||||
}
|
||||
}).done(() => {
|
||||
}).then(() => {
|
||||
this.setState({
|
||||
busy: false,
|
||||
});
|
||||
|
@ -93,7 +93,7 @@ export default createReactClass({
|
||||
this.setState({createError: e});
|
||||
}).finally(() => {
|
||||
this.setState({creating: false});
|
||||
}).done();
|
||||
}).then();
|
||||
},
|
||||
|
||||
_onCancel: function() {
|
||||
|
@ -78,7 +78,7 @@ export default createReactClass({
|
||||
true,
|
||||
);
|
||||
}
|
||||
}).done();
|
||||
}).then();
|
||||
},
|
||||
|
||||
componentWillUnmount: function() {
|
||||
|
@ -62,7 +62,7 @@ export default createReactClass({
|
||||
return;
|
||||
}
|
||||
this._addThreepid = new AddThreepid();
|
||||
this._addThreepid.addEmailAddress(emailAddress).done(() => {
|
||||
this._addThreepid.addEmailAddress(emailAddress).then(() => {
|
||||
Modal.createTrackedDialog('Verification Pending', '', QuestionDialog, {
|
||||
title: _t("Verification Pending"),
|
||||
description: _t(
|
||||
@ -96,7 +96,7 @@ export default createReactClass({
|
||||
},
|
||||
|
||||
verifyEmailAddress: function() {
|
||||
this._addThreepid.checkEmailLinkClicked().done(() => {
|
||||
this._addThreepid.checkEmailLinkClicked().then(() => {
|
||||
this.props.onFinished(true);
|
||||
}, (err) => {
|
||||
this.setState({emailBusy: false});
|
||||
|
@ -205,7 +205,7 @@ export default class AppTile extends React.Component {
|
||||
if (!this._scalarClient) {
|
||||
this._scalarClient = defaultManager.getScalarClient();
|
||||
}
|
||||
this._scalarClient.getScalarToken().done((token) => {
|
||||
this._scalarClient.getScalarToken().then((token) => {
|
||||
// Append scalar_token as a query param if not already present
|
||||
this._scalarClient.scalarToken = token;
|
||||
const u = url.parse(this._addWurlParams(this.props.url));
|
||||
|
@ -51,7 +51,7 @@ export default class EditableTextContainer extends React.Component {
|
||||
|
||||
this.setState({busy: true});
|
||||
|
||||
this.props.getInitialValue().done(
|
||||
this.props.getInitialValue().then(
|
||||
(result) => {
|
||||
if (this._unmounted) { return; }
|
||||
this.setState({
|
||||
@ -83,7 +83,7 @@ export default class EditableTextContainer extends React.Component {
|
||||
errorString: null,
|
||||
});
|
||||
|
||||
this.props.onSubmit(value).done(
|
||||
this.props.onSubmit(value).then(
|
||||
() => {
|
||||
if (this._unmounted) { return; }
|
||||
this.setState({
|
||||
|
@ -54,7 +54,7 @@ export default class ErrorBoundary extends React.PureComponent {
|
||||
if (!PlatformPeg.get()) return;
|
||||
|
||||
MatrixClientPeg.get().stopClient();
|
||||
MatrixClientPeg.get().store.deleteAllData().done(() => {
|
||||
MatrixClientPeg.get().store.deleteAllData().then(() => {
|
||||
PlatformPeg.get().reload();
|
||||
});
|
||||
};
|
||||
|
@ -84,7 +84,7 @@ export default class ImageView extends React.Component {
|
||||
title: _t('Error'),
|
||||
description: _t('You cannot delete this image. (%(code)s)', {code: code}),
|
||||
});
|
||||
}).done();
|
||||
}).then();
|
||||
},
|
||||
});
|
||||
};
|
||||
|
@ -49,7 +49,7 @@ export default class LanguageDropdown extends React.Component {
|
||||
this.setState({langs});
|
||||
}).catch(() => {
|
||||
this.setState({langs: ['en']});
|
||||
}).done();
|
||||
}).then();
|
||||
|
||||
if (!this.props.value) {
|
||||
// If no value is given, we start with the first
|
||||
|
@ -36,7 +36,7 @@ export default createReactClass({
|
||||
},
|
||||
|
||||
componentWillMount: function() {
|
||||
this.context.matrixClient.getJoinedGroups().done((result) => {
|
||||
this.context.matrixClient.getJoinedGroups().then((result) => {
|
||||
this.setState({groups: result.groups || [], error: null});
|
||||
}, (err) => {
|
||||
console.error(err);
|
||||
|
@ -55,7 +55,7 @@ export default class MAudioBody extends React.Component {
|
||||
decryptFile(content.file).then(function(blob) {
|
||||
decryptedBlob = blob;
|
||||
return URL.createObjectURL(decryptedBlob);
|
||||
}).done((url) => {
|
||||
}).then((url) => {
|
||||
this.setState({
|
||||
decryptedUrl: url,
|
||||
decryptedBlob: decryptedBlob,
|
||||
|
@ -289,7 +289,7 @@ export default class MImageBody extends React.Component {
|
||||
this.setState({
|
||||
error: err,
|
||||
});
|
||||
}).done();
|
||||
}).then();
|
||||
}
|
||||
|
||||
// Remember that the user wanted to show this particular image
|
||||
|
@ -115,7 +115,7 @@ module.exports = createReactClass({
|
||||
this.setState({
|
||||
error: err,
|
||||
});
|
||||
}).done();
|
||||
}).then();
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -870,7 +870,7 @@ const UserInfo = withLegacyMatrixClient(({matrixClient: cli, user, groupId, room
|
||||
},
|
||||
).finally(() => {
|
||||
stopUpdating();
|
||||
}).done();
|
||||
}).then();
|
||||
};
|
||||
|
||||
const roomId = user.roomId;
|
||||
|
@ -53,7 +53,7 @@ module.exports = createReactClass({
|
||||
);
|
||||
}, (error)=>{
|
||||
console.error("Failed to get URL preview: " + error);
|
||||
}).done();
|
||||
}).then();
|
||||
},
|
||||
|
||||
componentDidMount: function() {
|
||||
|
@ -248,7 +248,7 @@ module.exports = createReactClass({
|
||||
return client.getStoredDevicesForUser(member.userId);
|
||||
}).finally(function() {
|
||||
self._cancelDeviceList = null;
|
||||
}).done(function(devices) {
|
||||
}).then(function(devices) {
|
||||
if (cancelled) {
|
||||
// we got cancelled - presumably a different user now
|
||||
return;
|
||||
@ -572,7 +572,7 @@ module.exports = createReactClass({
|
||||
},
|
||||
).finally(()=>{
|
||||
this.setState({ updating: this.state.updating - 1 });
|
||||
}).done();
|
||||
}).then();
|
||||
},
|
||||
|
||||
onPowerChange: async function(powerLevel) {
|
||||
@ -629,7 +629,7 @@ module.exports = createReactClass({
|
||||
this.setState({ updating: this.state.updating + 1 });
|
||||
createRoom({dmUserId: this.props.member.userId}).finally(() => {
|
||||
this.setState({ updating: this.state.updating - 1 });
|
||||
}).done();
|
||||
}).then();
|
||||
},
|
||||
|
||||
onLeaveClick: function() {
|
||||
|
@ -112,7 +112,7 @@ module.exports = createReactClass({
|
||||
}
|
||||
});
|
||||
|
||||
httpPromise.done(function() {
|
||||
httpPromise.then(function() {
|
||||
self.setState({
|
||||
phase: self.Phases.Display,
|
||||
avatarUrl: MatrixClientPeg.get().mxcUrlToHttp(newUrl),
|
||||
|
@ -174,7 +174,7 @@ module.exports = createReactClass({
|
||||
newPassword: "",
|
||||
newPasswordConfirm: "",
|
||||
});
|
||||
}).done();
|
||||
}).then();
|
||||
},
|
||||
|
||||
_optionallySetEmail: function() {
|
||||
|
@ -52,7 +52,7 @@ export default class DevicesPanel extends React.Component {
|
||||
}
|
||||
|
||||
_loadDevices() {
|
||||
MatrixClientPeg.get().getDevices().done(
|
||||
MatrixClientPeg.get().getDevices().then(
|
||||
(resp) => {
|
||||
if (this._unmounted) { return; }
|
||||
this.setState({devices: resp.devices || []});
|
||||
|
@ -97,7 +97,7 @@ module.exports = createReactClass({
|
||||
phase: this.phases.LOADING,
|
||||
});
|
||||
|
||||
MatrixClientPeg.get().setPushRuleEnabled('global', self.state.masterPushRule.kind, self.state.masterPushRule.rule_id, !checked).done(function() {
|
||||
MatrixClientPeg.get().setPushRuleEnabled('global', self.state.masterPushRule.kind, self.state.masterPushRule.rule_id, !checked).then(function() {
|
||||
self._refreshFromServer();
|
||||
});
|
||||
},
|
||||
@ -170,7 +170,7 @@ module.exports = createReactClass({
|
||||
emailPusher.kind = null;
|
||||
emailPusherPromise = MatrixClientPeg.get().setPusher(emailPusher);
|
||||
}
|
||||
emailPusherPromise.done(() => {
|
||||
emailPusherPromise.then(() => {
|
||||
this._refreshFromServer();
|
||||
}, (error) => {
|
||||
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
||||
@ -274,7 +274,7 @@ module.exports = createReactClass({
|
||||
}
|
||||
}
|
||||
|
||||
Promise.all(deferreds).done(function() {
|
||||
Promise.all(deferreds).then(function() {
|
||||
self._refreshFromServer();
|
||||
}, function(error) {
|
||||
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
||||
@ -343,7 +343,7 @@ module.exports = createReactClass({
|
||||
}
|
||||
}
|
||||
|
||||
Promise.all(deferreds).done(function(resps) {
|
||||
Promise.all(deferreds).then(function(resps) {
|
||||
self._refreshFromServer();
|
||||
}, function(error) {
|
||||
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
||||
@ -398,7 +398,7 @@ module.exports = createReactClass({
|
||||
};
|
||||
|
||||
// Then, add the new ones
|
||||
Promise.all(removeDeferreds).done(function(resps) {
|
||||
Promise.all(removeDeferreds).then(function(resps) {
|
||||
const deferreds = [];
|
||||
|
||||
let pushRuleVectorStateKind = self.state.vectorContentRules.vectorState;
|
||||
@ -434,7 +434,7 @@ module.exports = createReactClass({
|
||||
}
|
||||
}
|
||||
|
||||
Promise.all(deferreds).done(function(resps) {
|
||||
Promise.all(deferreds).then(function(resps) {
|
||||
self._refreshFromServer();
|
||||
}, onError);
|
||||
}, onError);
|
||||
@ -650,7 +650,7 @@ module.exports = createReactClass({
|
||||
externalContentRules: self.state.externalContentRules,
|
||||
externalPushRules: self.state.externalPushRules,
|
||||
});
|
||||
}).done();
|
||||
}).then();
|
||||
|
||||
MatrixClientPeg.get().getThreePids().then((r) => this.setState({threepids: r.threepids}));
|
||||
},
|
||||
|
@ -75,7 +75,7 @@ export default class HelpUserSettingsTab extends React.Component {
|
||||
// stopping in the middle of the logs.
|
||||
console.log("Clear cache & reload clicked");
|
||||
MatrixClientPeg.get().stopClient();
|
||||
MatrixClientPeg.get().store.deleteAllData().done(() => {
|
||||
MatrixClientPeg.get().store.deleteAllData().then(() => {
|
||||
PlatformPeg.get().reload();
|
||||
});
|
||||
};
|
||||
|
@ -186,7 +186,7 @@ class RoomViewStore extends Store {
|
||||
roomLoading: true,
|
||||
roomLoadError: null,
|
||||
});
|
||||
MatrixClientPeg.get().getRoomIdForAlias(payload.room_alias).done(
|
||||
MatrixClientPeg.get().getRoomIdForAlias(payload.room_alias).then(
|
||||
(result) => {
|
||||
dis.dispatch({
|
||||
action: 'view_room',
|
||||
@ -223,7 +223,7 @@ class RoomViewStore extends Store {
|
||||
});
|
||||
MatrixClientPeg.get().joinRoom(
|
||||
this._state.roomAlias || this._state.roomId, payload.opts,
|
||||
).done(() => {
|
||||
).then(() => {
|
||||
// We don't actually need to do anything here: we do *not*
|
||||
// clear the 'joining' flag because the Room object and/or
|
||||
// our 'joined' member event may not have come down the sync
|
||||
|
@ -26,6 +26,7 @@ import sdk from 'matrix-react-sdk';
|
||||
import MatrixClientPeg from '../../../../src/MatrixClientPeg';
|
||||
|
||||
import * as test_utils from '../../../test-utils';
|
||||
import {sleep} from "../../../../src/utils/promise";
|
||||
|
||||
const InteractiveAuthDialog = sdk.getComponent(
|
||||
'views.dialogs.InteractiveAuthDialog',
|
||||
@ -107,7 +108,7 @@ describe('InteractiveAuthDialog', function() {
|
||||
},
|
||||
})).toBe(true);
|
||||
// let the request complete
|
||||
return Promise.delay(1);
|
||||
return sleep(1);
|
||||
}).then(() => {
|
||||
expect(onFinished.callCount).toEqual(1);
|
||||
expect(onFinished.calledWithExactly(true, {a: 1})).toBe(true);
|
||||
|
@ -91,7 +91,7 @@ describe('MemberEventListSummary', function() {
|
||||
testUtils.beforeEach(this);
|
||||
sandbox = testUtils.stubClient();
|
||||
|
||||
languageHandler.setLanguage('en').done(done);
|
||||
languageHandler.setLanguage('en').then(done);
|
||||
languageHandler.setMissingEntryGenerator(function(key) {
|
||||
return key.split('|', 2)[1];
|
||||
});
|
||||
|
@ -8,6 +8,7 @@ import * as testUtils from '../../../test-utils';
|
||||
import sdk from 'matrix-react-sdk';
|
||||
const MessageComposerInput = sdk.getComponent('views.rooms.MessageComposerInput');
|
||||
import MatrixClientPeg from '../../../../src/MatrixClientPeg';
|
||||
import {sleep} from "../../../../src/utils/promise";
|
||||
|
||||
function addTextToDraft(text) {
|
||||
const components = document.getElementsByClassName('public-DraftEditor-content');
|
||||
@ -49,7 +50,7 @@ xdescribe('MessageComposerInput', () => {
|
||||
// warnings
|
||||
// (please can we make the components not setState() after
|
||||
// they are unmounted?)
|
||||
Promise.delay(10).done(() => {
|
||||
sleep(10).then(() => {
|
||||
if (parentDiv) {
|
||||
ReactDOM.unmountComponentAtNode(parentDiv);
|
||||
parentDiv.remove();
|
||||
|
@ -11,7 +11,7 @@ describe('languageHandler', function() {
|
||||
testUtils.beforeEach(this);
|
||||
sandbox = testUtils.stubClient();
|
||||
|
||||
languageHandler.setLanguage('en').done(done);
|
||||
languageHandler.setLanguage('en').then(done);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
|
Loading…
Reference in New Issue
Block a user