apply shouldHideEvent fn to onRoomTimeline for RoomStatusBar

prevents N new message(s) when a hidden message comes in.
pull/21833/head
Michael Telatynski 2017-08-28 13:46:09 +01:00
parent 6077693829
commit 315f7a3ae7
No known key found for this signature in database
GPG Key ID: 3F879DA5AD802A5E
1 changed files with 5 additions and 2 deletions

View File

@ -20,6 +20,8 @@ limitations under the License.
// - Drag and drop // - Drag and drop
// - File uploading - uploadFile() // - File uploading - uploadFile()
import shouldHideEvent from "../../shouldHideEvent";
var React = require("react"); var React = require("react");
var ReactDOM = require("react-dom"); var ReactDOM = require("react-dom");
import Promise from 'bluebird'; import Promise from 'bluebird';
@ -143,6 +145,8 @@ module.exports = React.createClass({
MatrixClientPeg.get().on("RoomMember.membership", this.onRoomMemberMembership); MatrixClientPeg.get().on("RoomMember.membership", this.onRoomMemberMembership);
MatrixClientPeg.get().on("accountData", this.onAccountData); MatrixClientPeg.get().on("accountData", this.onAccountData);
this._syncedSettings = UserSettingsStore.getSyncedSettings();
// Start listening for RoomViewStore updates // Start listening for RoomViewStore updates
this._roomStoreToken = RoomViewStore.addListener(this._onRoomViewStoreUpdate); this._roomStoreToken = RoomViewStore.addListener(this._onRoomViewStoreUpdate);
this._onRoomViewStoreUpdate(true); this._onRoomViewStoreUpdate(true);
@ -497,8 +501,7 @@ module.exports = React.createClass({
// update unread count when scrolled up // update unread count when scrolled up
if (!this.state.searchResults && this.state.atEndOfLiveTimeline) { if (!this.state.searchResults && this.state.atEndOfLiveTimeline) {
// no change // no change
} } else if (!shouldHideEvent(ev, this._syncedSettings)) {
else {
this.setState((state, props) => { this.setState((state, props) => {
return {numUnreadMessages: state.numUnreadMessages + 1}; return {numUnreadMessages: state.numUnreadMessages + 1};
}); });