fix spinner on createroom

pull/21833/head
Matthew Hodgson 2016-09-17 02:19:32 +01:00
parent 026a2e6c7c
commit c51e6907f0
1 changed files with 11 additions and 6 deletions

View File

@ -41,10 +41,12 @@ function createRoom(opts) {
const client = MatrixClientPeg.get(); const client = MatrixClientPeg.get();
if (client.isGuest()) { if (client.isGuest()) {
setTimeout(()=>{
Modal.createDialog(NeedToRegisterDialog, { Modal.createDialog(NeedToRegisterDialog, {
title: "Please Register", title: "Please Register",
description: "Guest users can't create new rooms. Please register to create room and start a chat." description: "Guest users can't create new rooms. Please register to create room and start a chat."
}); })
}, 0);
return q(null); return q(null);
} }
@ -74,11 +76,14 @@ function createRoom(opts) {
} }
]; ];
const modal = Modal.createDialog(Loader, null, 'mx_Dialog_spinner'); let modal;
setTimeout(()=>{
modal = Modal.createDialog(Loader, null, 'mx_Dialog_spinner')
}, 0);
let roomId; let roomId;
return client.createRoom(createOpts).finally(function() { return client.createRoom(createOpts).finally(function() {
modal.close(); if (modal) modal.close();
}).then(function(res) { }).then(function(res) {
roomId = res.room_id; roomId = res.room_id;
if (opts.dmUserId) { if (opts.dmUserId) {