mirror of
https://github.com/element-hq/element-web
synced 2024-11-23 17:56:01 +03:00
Add creatingRoom state to know when to show a spinner.
This commit is contained in:
parent
a2b77ad5b5
commit
2a1b9cd716
1 changed files with 9 additions and 2 deletions
|
@ -161,6 +161,7 @@ module.exports = {
|
||||||
onChatClick: function() {
|
onChatClick: function() {
|
||||||
// check if there are any existing rooms with just us and them (1:1)
|
// check if there are any existing rooms with just us and them (1:1)
|
||||||
// If so, just view that room. If not, create a private room with them.
|
// If so, just view that room. If not, create a private room with them.
|
||||||
|
var self = this;
|
||||||
var rooms = MatrixClientPeg.get().getRooms();
|
var rooms = MatrixClientPeg.get().getRooms();
|
||||||
var userIds = [
|
var userIds = [
|
||||||
this.props.member.userId,
|
this.props.member.userId,
|
||||||
|
@ -189,23 +190,28 @@ module.exports = {
|
||||||
action: 'view_room',
|
action: 'view_room',
|
||||||
room_id: existingRoomId
|
room_id: existingRoomId
|
||||||
});
|
});
|
||||||
|
this.props.onFinished();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
self.setState({ creatingRoom: true });
|
||||||
MatrixClientPeg.get().createRoom({
|
MatrixClientPeg.get().createRoom({
|
||||||
invite: [this.props.member.userId],
|
invite: [this.props.member.userId],
|
||||||
preset: "private_chat"
|
preset: "private_chat"
|
||||||
}).done(function(res) {
|
}).done(function(res) {
|
||||||
|
self.setState({ creatingRoom: false });
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: 'view_room',
|
action: 'view_room',
|
||||||
room_id: res.room_id
|
room_id: res.room_id
|
||||||
});
|
});
|
||||||
|
self.props.onFinished();
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
|
self.setState({ creatingRoom: false });
|
||||||
console.error(
|
console.error(
|
||||||
"Failed to create room: %s", JSON.stringify(err)
|
"Failed to create room: %s", JSON.stringify(err)
|
||||||
);
|
);
|
||||||
|
self.props.onFinished();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.props.onFinished();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// FIXME: this is horribly duplicated with MemberTile's onLeaveClick.
|
// FIXME: this is horribly duplicated with MemberTile's onLeaveClick.
|
||||||
|
@ -249,7 +255,8 @@ module.exports = {
|
||||||
modifyLevel: false
|
modifyLevel: false
|
||||||
},
|
},
|
||||||
muted: false,
|
muted: false,
|
||||||
isTargetMod: false
|
isTargetMod: false,
|
||||||
|
creatingRoom: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue