Rename onHaveRoom
And move some code out of it which didn't really have any reason to be hanging out there rather than just be where we set the room a few lines above.
This commit is contained in:
parent
bf982004f6
commit
aee2f3cdef
1 changed files with 7 additions and 9 deletions
|
@ -189,6 +189,11 @@ module.exports = React.createClass({
|
||||||
// the RoomView instance
|
// the RoomView instance
|
||||||
if (initial) {
|
if (initial) {
|
||||||
newState.room = MatrixClientPeg.get().getRoom(newState.roomId);
|
newState.room = MatrixClientPeg.get().getRoom(newState.roomId);
|
||||||
|
if (newState.room) {
|
||||||
|
newState.unsentMessageError = this._getUnsentMessageError(newState.room);
|
||||||
|
newState.showApps = this._shouldShowApps(newState.room);
|
||||||
|
this._onRoomLoaded(newState.room);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.state.roomId === null && newState.roomId !== null) {
|
if (this.state.roomId === null && newState.roomId !== null) {
|
||||||
|
@ -220,11 +225,11 @@ module.exports = React.createClass({
|
||||||
// callback because this would prevent the setStates from being batched,
|
// callback because this would prevent the setStates from being batched,
|
||||||
// ie. cause it to render RoomView twice rather than the once that is necessary.
|
// ie. cause it to render RoomView twice rather than the once that is necessary.
|
||||||
if (initial) {
|
if (initial) {
|
||||||
this._onHaveRoom(newState.room, newState.roomId, newState.joining, newState.shouldPeek);
|
this._setupRoom(newState.room, newState.roomId, newState.joining, newState.shouldPeek);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onHaveRoom: function(room, roomId, joining, shouldPeek) {
|
_setupRoom: function(room, roomId, joining, shouldPeek) {
|
||||||
// if this is an unknown room then we're in one of three states:
|
// if this is an unknown room then we're in one of three states:
|
||||||
// - This is a room we can peek into (search engine) (we can /peek)
|
// - This is a room we can peek into (search engine) (we can /peek)
|
||||||
// - This is a room we can publicly join or were invited to. (we can /join)
|
// - This is a room we can publicly join or were invited to. (we can /join)
|
||||||
|
@ -240,13 +245,6 @@ module.exports = React.createClass({
|
||||||
// about it). We don't peek in the historical case where we were joined but are
|
// about it). We don't peek in the historical case where we were joined but are
|
||||||
// now not joined because the js-sdk peeking API will clobber our historical room,
|
// now not joined because the js-sdk peeking API will clobber our historical room,
|
||||||
// making it impossible to indicate a newly joined room.
|
// making it impossible to indicate a newly joined room.
|
||||||
if (room) {
|
|
||||||
this.setState({
|
|
||||||
unsentMessageError: this._getUnsentMessageError(room),
|
|
||||||
showApps: this._shouldShowApps(room),
|
|
||||||
});
|
|
||||||
this._onRoomLoaded(room);
|
|
||||||
}
|
|
||||||
if (!joining && roomId) {
|
if (!joining && roomId) {
|
||||||
if (this.props.autoJoin) {
|
if (this.props.autoJoin) {
|
||||||
this.onJoinButtonClicked();
|
this.onJoinButtonClicked();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue