You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-08-18 05:42:00 +03:00
Fix linting errors
This commit is contained in:
@@ -94,6 +94,13 @@ utils.inherits(Room, EventEmitter);
|
||||
*/
|
||||
Room.prototype.addEventsToTimeline = function(events, toStartOfTimeline) {
|
||||
var stateContext = toStartOfTimeline ? this.oldState : this.currentState;
|
||||
|
||||
function checkForRedaction(redactEvent) {
|
||||
return function(e) {
|
||||
return e.getId() === redactEvent.event.redacts;
|
||||
};
|
||||
}
|
||||
|
||||
for (var i = 0; i < events.length; i++) {
|
||||
if (toStartOfTimeline && this._redactions.indexOf(events[i].getId()) >= 0) {
|
||||
continue; // do not add the redacted event.
|
||||
@@ -112,9 +119,9 @@ Room.prototype.addEventsToTimeline = function(events, toStartOfTimeline) {
|
||||
}
|
||||
if (events[i].getType() === "m.room.redaction") {
|
||||
// try to remove the element
|
||||
var removed = utils.removeElement(this.timeline, function(e) {
|
||||
return e.getId() === events[i].event.redacts
|
||||
}, true);
|
||||
var removed = utils.removeElement(
|
||||
this.timeline, checkForRedaction(events[i])
|
||||
);
|
||||
if (!removed && toStartOfTimeline) {
|
||||
// redactions will trickle in BEFORE the event redacted so make
|
||||
// a note of the redacted event; we'll check it later.
|
||||
|
@@ -148,7 +148,7 @@ module.exports.findElement = function(array, fn, reverse) {
|
||||
* function signature <code>fn(element, index, array)</code>. Return true to
|
||||
* remove this element and break.
|
||||
* @param {boolean} reverse True to search in reverse order.
|
||||
* @return True if an element was removed.
|
||||
* @return {boolean} True if an element was removed.
|
||||
*/
|
||||
module.exports.removeElement = function(array, fn, reverse) {
|
||||
var i;
|
||||
|
Reference in New Issue
Block a user