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) {
|
Room.prototype.addEventsToTimeline = function(events, toStartOfTimeline) {
|
||||||
var stateContext = toStartOfTimeline ? this.oldState : this.currentState;
|
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++) {
|
for (var i = 0; i < events.length; i++) {
|
||||||
if (toStartOfTimeline && this._redactions.indexOf(events[i].getId()) >= 0) {
|
if (toStartOfTimeline && this._redactions.indexOf(events[i].getId()) >= 0) {
|
||||||
continue; // do not add the redacted event.
|
continue; // do not add the redacted event.
|
||||||
@@ -112,9 +119,9 @@ Room.prototype.addEventsToTimeline = function(events, toStartOfTimeline) {
|
|||||||
}
|
}
|
||||||
if (events[i].getType() === "m.room.redaction") {
|
if (events[i].getType() === "m.room.redaction") {
|
||||||
// try to remove the element
|
// try to remove the element
|
||||||
var removed = utils.removeElement(this.timeline, function(e) {
|
var removed = utils.removeElement(
|
||||||
return e.getId() === events[i].event.redacts
|
this.timeline, checkForRedaction(events[i])
|
||||||
}, true);
|
);
|
||||||
if (!removed && toStartOfTimeline) {
|
if (!removed && toStartOfTimeline) {
|
||||||
// redactions will trickle in BEFORE the event redacted so make
|
// redactions will trickle in BEFORE the event redacted so make
|
||||||
// a note of the redacted event; we'll check it later.
|
// 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
|
* function signature <code>fn(element, index, array)</code>. Return true to
|
||||||
* remove this element and break.
|
* remove this element and break.
|
||||||
* @param {boolean} reverse True to search in reverse order.
|
* @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) {
|
module.exports.removeElement = function(array, fn, reverse) {
|
||||||
var i;
|
var i;
|
||||||
|
Reference in New Issue
Block a user