Hide events that were sent by ignored users

This code only kicks in if the user was ignored after an event was sent. The homeserver should prevent other events from coming in.

Signed-off-by: Travis Ralston <travpc@gmail.com>
This commit is contained in:
turt2live 2017-09-14 20:16:56 -06:00
parent 3889df6b08
commit 2e72d6cd7c
4 changed files with 11 additions and 1 deletions

View file

@ -131,6 +131,9 @@ export default React.createClass({
useCompactLayout: event.getContent().useCompactLayout,
});
}
if (event.getType() === "m.ignored_user_list") {
dis.dispatch({action: "ignore_state_changed"});
}
},
_onKeyDown: function(ev) {

View file

@ -241,6 +241,10 @@ module.exports = React.createClass({
// TODO: Implement granular (per-room) hide options
_shouldShowEvent: function(mxEv) {
if (MatrixClientPeg.get().isUserIgnored(mxEv.sender.userId)) {
return false; // ignored = no show (only happens if the ignore happens after an event was received)
}
const EventTile = sdk.getComponent('rooms.EventTile');
if (!EventTile.haveTileForEvent(mxEv)) {
return false; // no tile = no show

View file

@ -384,6 +384,9 @@ var TimelinePanel = React.createClass({
this.sendReadReceipt();
this.updateReadMarker();
break;
case 'ignore_state_changed':
this.forceUpdate();
break;
}
},

View file

@ -115,7 +115,7 @@ module.exports = withMatrixClient(React.createClass({
},
_checkIgnoreState: function() {
const isIgnoring = this.props.matrixClient.getIgnoredUsers().indexOf(this.props.member.userId) !== -1;
const isIgnoring = this.props.matrixClient.isUserIgnored(this.props.member.userId);
this.setState({isIgnoring: isIgnoring});
},