Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Show when you've been kicked or banned #709

Merged
merged 5 commits into from
Feb 17, 2017
Merged

Show when you've been kicked or banned #709

merged 5 commits into from
Feb 17, 2017

Conversation

dbkr
Copy link
Member

@dbkr dbkr commented Feb 17, 2017

Update the room state when you've been kicked or banned, and show
a message in the preview bar, including the reason.

Update the room state when you've been kicked or banned, and show
a message in the preview bar, including the reason.
@dbkr dbkr requested a review from kegsay February 17, 2017 15:53
@@ -1573,6 +1583,7 @@ module.exports = React.createClass({
}
aux = (
<RoomPreviewBar onJoinClick={this.onJoinButtonClicked}
onForgetClick={ this.onForgetClick }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is missing in propTypes in RoomPreviewBar.

@@ -159,6 +159,7 @@ module.exports = React.createClass({
MatrixClientPeg.get().on("Room.name", this.onRoomName);
MatrixClientPeg.get().on("Room.accountData", this.onRoomAccountData);
MatrixClientPeg.get().on("RoomState.members", this.onRoomStateMember);
MatrixClientPeg.get().on("RoomMember.membership", this.onRoomMemberMembership);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could alternatively use onRoomStateMember instead, but I don't really care either way (1 extra listener isn't a big deal).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could do, this quite nicely separates out stuff related to our room membership into a separate function though. Don't really mind either way.

You have been {verb} from {roomName} by {kicker.displayName}.<br />
{reason}
<a onClick={ this.props.onForgetClick }><b>Forget</b></a><br />
{rejoinBlock}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Order feels weird. I'd have thought re-joining would appear before forget since we expect re-join to be used more? IDK

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably right actually

joinBlock = (
<div>
<div className="mx_RoomPreviewBar_join_text">
You have been {verb} from {roomName} by {kicker.displayName}.<br />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kicker is a User which will only exist if the JS SDK has a m.presence event for this user ID. In other words, there are no guarantees that kicker != null so we should null guard.

Also, .displayName afaik will just be the displayname field of the m.presence event. What happens if there is no display name?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point - presumably getMember is actually better? We'll always get the state when we left.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per RL: There are no guarantees that the person who banned you will exist when you getMember (e.g. invite -> ban).

@kegsay
Copy link
Member

kegsay commented Feb 17, 2017

Otherwise LGTM.

@kegsay
Copy link
Member

kegsay commented Feb 17, 2017

LGTM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants