Merge branch 'matthew/roompreview' of https://github.com/matrix-org/matrix-react-sdk into matthew/roompreview
This commit is contained in:
commit
5c105a50e2
1 changed files with 21 additions and 10 deletions
|
@ -118,15 +118,11 @@ module.exports = React.createClass({
|
|||
if (!this.state.room) {
|
||||
if (this.props.autoPeek) {
|
||||
console.log("Attempting to peek into room %s", this.props.roomId);
|
||||
MatrixClientPeg.get().peekInRoom(this.props.roomId).done(() => {
|
||||
// we don't need to do anything - JS SDK will emit Room events
|
||||
// which will update the UI. We *do* however need to know if we
|
||||
// can join the room so we can fiddle with the UI appropriately.
|
||||
|
||||
// ...XXX: or do we? can't we just do them onNewRoom?
|
||||
}, function(err) {
|
||||
MatrixClientPeg.get().peekInRoom(this.props.roomId).catch((err) => {
|
||||
console.error("Failed to peek into room: %s", err);
|
||||
}).finally(() => {
|
||||
// we don't need to do anything - JS SDK will emit Room events
|
||||
// which will update the UI.
|
||||
this.setState({
|
||||
autoPeekDone: true
|
||||
});
|
||||
|
@ -379,6 +375,14 @@ module.exports = React.createClass({
|
|||
if (member.roomId === this.props.roomId) {
|
||||
// a member state changed in this room, refresh the tab complete list
|
||||
this._updateTabCompleteList(this.state.room);
|
||||
|
||||
var room = MatrixClientPeg.get().getRoom(this.props.roomId);
|
||||
var me = MatrixClientPeg.get().credentials.userId;
|
||||
if (this.state.joining && room.hasMembershipState(me, "join")) {
|
||||
this.setState({
|
||||
joining: false
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.props.ConferenceHandler) {
|
||||
|
@ -552,10 +556,17 @@ module.exports = React.createClass({
|
|||
|
||||
onJoinButtonClicked: function(ev) {
|
||||
var self = this;
|
||||
MatrixClientPeg.get().joinRoom(this.props.roomId).then(function() {
|
||||
MatrixClientPeg.get().joinRoom(this.props.roomId).done(function() {
|
||||
// It is possible that there is no Room yet if state hasn't come down
|
||||
// from /sync - joinRoom will resolve when the HTTP request to join succeeds,
|
||||
// NOT when it comes down /sync. If there is no room, we'll keep the
|
||||
// joining flag set until we see it. Likewise, if our state is not
|
||||
// "join" we'll keep this flag set until it comes down /sync.
|
||||
var room = MatrixClientPeg.get().getRoom(self.props.roomId);
|
||||
var me = MatrixClientPeg.get().credentials.userId;
|
||||
self.setState({
|
||||
joining: false,
|
||||
room: MatrixClientPeg.get().getRoom(self.props.roomId)
|
||||
joining: room ? !room.hasMembershipState(me, "join") : true,
|
||||
room: room
|
||||
});
|
||||
}, function(error) {
|
||||
self.setState({
|
||||
|
|
Loading…
Reference in a new issue