-
-
Notifications
You must be signed in to change notification settings - Fork 831
Show a warning if the user attempts to leave a room that is invite only #1713
Conversation
Welcome back :D |
_leaveRoomWarnings: function(roomId) { | ||
const roomToLeave = MatrixClientPeg.get().getRoom(roomId); | ||
// Show a warning if there are additional complications. | ||
const roomState = roomToLeave.getLiveTimeline().getState("f"); |
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.
ooi why this vs roomToLeave.currentState
?
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.
oh RIP
The state of the room at the time of the newest event in the timeline. Present for backwards compatibility - prefer getLiveTimeline().getState(false).
I've been using currentState for ages :L
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.
turns out that doc is wrong because false !== 'f'
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.
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.
Yah thats why I said
turns out that doc is wrong because false !== 'f'
I'll look into fixing that
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.
GH doesn't update comments quick enough. Anyway will fix indentation + using currentState instead.
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.
Noooo, docs say prefer getState, the bit thats wrong is the arg
I'm lazy and use currentState, but if docs say prefer yours then you do you
2e8c7e6
to
c998146
Compare
c998146
to
5206c9d
Compare
Looks good to me, I'll throw it at someone |
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.
lgtm - thanks!
Partial fix for
element-hq/element-web#2855
element-hq/element-web#5797
Signed-off-by: Will Hunt will@half-shot.uk