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

Show a warning if the user attempts to leave a room that is invite only #1713

Merged
merged 1 commit into from
Jan 20, 2018

Conversation

Half-Shot
Copy link
Contributor

@Half-Shot Half-Shot commented Jan 19, 2018

@t3chguy
Copy link
Member

t3chguy commented Jan 19, 2018

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");
Copy link
Member

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 ?

Copy link
Member

@t3chguy t3chguy Jan 19, 2018

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

Copy link
Member

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'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

screenshot from 2018-01-19 22-46-31

I'm guessing the docs are lying?

Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Member

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

@t3chguy
Copy link
Member

t3chguy commented Jan 19, 2018

Looks good to me, I'll throw it at someone

Copy link
Member

@ara4n ara4n left a comment

Choose a reason for hiding this comment

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

lgtm - thanks!

@ara4n ara4n merged commit 5125683 into matrix-org:develop Jan 20, 2018
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.

3 participants