diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index accf96f349..9aa192d9ca 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -482,7 +482,9 @@ module.exports = React.createClass({ } }, - onRoomStateMember: function(ev, state, member) { + // rate limited because a power level change will emit an event for every + // member in the room. + onRoomStateMember: new rate_limited_func(function(ev, state, member) { // ignore if we don't have a room yet if (!this.state.room) { return; @@ -511,7 +513,7 @@ module.exports = React.createClass({ member.userId === this.props.ConferenceHandler.getConferenceUserIdForRoom(member.roomId)) { this._updateConfCallNotification(); } - }, + }, 500), _hasUnsentMessages: function(room) { return this._getUnsentMessages(room).length > 0; diff --git a/src/ratelimitedfunc.js b/src/ratelimitedfunc.js index 453669b477..94626d5ad9 100644 --- a/src/ratelimitedfunc.js +++ b/src/ratelimitedfunc.js @@ -23,13 +23,13 @@ module.exports = function(f, minIntervalMs) { var now = Date.now(); if (self.lastCall < now - minIntervalMs) { - f.apply(this); + f.apply(this, arguments); self.lastCall = now; } else if (self.scheduledCall === undefined) { self.scheduledCall = setTimeout( () => { self.scheduledCall = undefined; - f.apply(this); + f.apply(this, arguments); self.lastCall = now; }, (self.lastCall + minIntervalMs) - now