-
-
Notifications
You must be signed in to change notification settings - Fork 832
Show when you've been kicked or banned #709
Conversation
Update the room state when you've been kicked or banned, and show a message in the preview bar, including the reason.
@@ -1573,6 +1583,7 @@ module.exports = React.createClass({ | |||
} | |||
aux = ( | |||
<RoomPreviewBar onJoinClick={this.onJoinButtonClicked} | |||
onForgetClick={ this.onForgetClick } |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 /> |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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).
Otherwise LGTM. |
Here, and also in MemberEventListSummary where this also broke.
LGTM |
Update the room state when you've been kicked or banned, and show
a message in the preview bar, including the reason.