Fix PR feedback

This commit is contained in:
David Baker 2016-06-20 18:05:58 +01:00
parent 4d5fbfc5b1
commit 4c214119b2
2 changed files with 18 additions and 14 deletions

View File

@ -489,17 +489,17 @@ module.exports = React.createClass({
// switch view to the given room
//
// @param {Object} room_info Object containing data about the room to be joined
// @param {string} room_info.room_id ID of the room to join. One of room_id or room_alias must be given.
// @param {string} room_info.room_alias Alias of the room to join. One of room_id or room_alias must be given.
// @param {boolean} room_info.auto_join If true, automatically attempt to join the room if not already a member.
// @param {string} room_info.show_settings ??
// @param {string} room_info.event_id ID of the event in this room to show: this will cause a switch to the
// context of that particular event. Optional.
// @param {Object} room_info.third_party_invite Object containing data about the third party
// @param {string=} room_info.room_id ID of the room to join. One of room_id or room_alias must be given.
// @param {string=} room_info.room_alias Alias of the room to join. One of room_id or room_alias must be given.
// @param {boolean=} room_info.auto_join If true, automatically attempt to join the room if not already a member.
// @param {boolean=} room_info.show_settings Makes RoomView show the room settings dialog.
// @param {string=} room_info.event_id ID of the event in this room to show: this will cause a switch to the
// context of that particular event.
// @param {Object=} room_info.third_party_invite Object containing data about the third party
// we received to join the room, if any.
// @param {string} room_info.third_party_invite.inviteSignUrl 3pid invite sign URL
// @param {string} room_info.third_party_invite.invitedwithEmail The email address the invite was sent to
// @param {Object} room_info.oob_data Object of additional data about the room
// @param {string=} room_info.third_party_invite.inviteSignUrl 3pid invite sign URL
// @param {string=} room_info.third_party_invite.invitedEmail The email address the invite was sent to
// @param {Object=} room_info.oob_data Object of additional data about the room
// that has been passed out-of-band (eg.
// room name and avatar from an invite email)
_viewRoom: function(room_info) {
@ -557,7 +557,7 @@ module.exports = React.createClass({
}
if (room_info.event_id) {
presentedId += "/"+event_id;
presentedId += "/"+room_info.event_id;
}
this.notifyNewScreen('room/'+presentedId);
newState.ready = true;

View File

@ -191,8 +191,12 @@ module.exports = React.createClass({
// NB. We peek if we are not in the room, although if we try to peek into
// a room in which we have a member event (ie. we've left) synapse will just
// send us the same data as we get in the sync (ie. the last events we saw).
var my_member = this.state.room ? this.state.room.getMember(MatrixClientPeg.get().credentials.userId) : null;
var user_is_in_room = my_member ? my_member.membership == 'join' : false;
var user_is_in_room = null;
if (this.state.room) {
user_is_in_room = this.state.room.hasMembershipState(
MatrixClientPeg.get().credentials.userId, 'join'
);
}
if (!user_is_in_room && this.state.roomId) {
if (this.props.autoJoin) {
@ -1003,7 +1007,7 @@ module.exports = React.createClass({
this.setState({
rejecting: true
});
MatrixClientPeg.get().leave(this.props.roomId).done(function() {
MatrixClientPeg.get().leave(this.state.roomId).done(function() {
dis.dispatch({ action: 'view_next_room' });
self.setState({
rejecting: false