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

Implement bulk invite rejections #592

Merged
merged 5 commits into from
Dec 15, 2016
Merged

Implement bulk invite rejections #592

merged 5 commits into from
Dec 15, 2016

Conversation

kegsay
Copy link
Member

@kegsay kegsay commented Dec 14, 2016

No description provided.

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

couple of niggles

@@ -101,6 +108,7 @@ module.exports = React.createClass({
middleOpacity: 1.0,
});
dis.unregister(this.dispatcherRef);
MatrixClientPeg.get().removeListener("RoomMember.membership", this._onInviteStateChange);
Copy link
Member

Choose a reason for hiding this comment

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

we might have been logged out by the time we get here; needs a null check

Copy link
Member Author

Choose a reason for hiding this comment

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

You mean MatrixClientPeg.get() is nullable?!

Copy link
Member Author

Choose a reason for hiding this comment

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

$ grep -rn "MatrixClientPeg\.get()\." matrix-react-sdk/src/ | wc -l
     264

There are a lot of assumptions in other UI components that assume MatrixClientPeg is not null. These are generally safe assumptions because the UI component in question isn't shown when the user is not logged in: as is the case here. I would rather not increase the SNR any more than I need to. WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

yup, MatrixClientPeg.get() will return null after you log out.

In general you are right, but this is in an componentWillUnmount method which will be called when the user logs out. You should find that any other references to MatrixClientPeg.get in componentWillUnmount have null guards - any which don't are also bugs.

(We're actually in the process of switching to passing the MatrixClient via the react context rather than using the MatrixClientPeg singleton, which means that components can rely on the MatrixClient not changing under them. But we're already using MatrixClientPeg in this component and I'd rather not mix usage in a single component.)

Copy link
Member Author

Choose a reason for hiding this comment

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

Ahhh okay. Done.

this.setState({
rejectingInvites: false
});
});
Copy link
Member

Choose a reason for hiding this comment

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

still needs a .done() to catch exceptions from the setState?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ugh, yes you're right.

/me pines for bluebird

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@richvdh richvdh assigned kegsay and unassigned richvdh Dec 15, 2016
@kegsay
Copy link
Member Author

kegsay commented Dec 15, 2016

PTAL @richvdh

@kegsay kegsay merged commit 71132c4 into develop Dec 15, 2016
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