You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
Merge pull request #989 from matrix-org/travis/edu-timeline
Process ephemeral events outside timeline handling
This commit is contained in:
@@ -104,7 +104,7 @@ describe("Room", function() {
|
|||||||
user_ids: [userA],
|
user_ids: [userA],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
room.addLiveEvents([typing]);
|
room.addEphemeralEvents([typing]);
|
||||||
expect(room.currentState.setTypingEvent).toHaveBeenCalledWith(typing);
|
expect(room.currentState.setTypingEvent).toHaveBeenCalledWith(typing);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1420,18 +1420,23 @@ Room.prototype.addLiveEvents = function(events, duplicateStrategy) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < events.length; i++) {
|
for (i = 0; i < events.length; i++) {
|
||||||
if (events[i].getType() === "m.typing") {
|
// TODO: We should have a filter to say "only add state event
|
||||||
this.currentState.setTypingEvent(events[i]);
|
// types X Y Z to the timeline".
|
||||||
} else if (events[i].getType() === "m.receipt") {
|
this._addLiveEvent(events[i], duplicateStrategy);
|
||||||
this.addReceipt(events[i]);
|
}
|
||||||
}
|
};
|
||||||
// N.B. account_data is added directly by /sync to avoid
|
|
||||||
// having to maintain an event.isAccountData() here
|
/**
|
||||||
else {
|
* Adds/handles ephemeral events such as typing notifications and read receipts.
|
||||||
// TODO: We should have a filter to say "only add state event
|
* @param {MatrixEvent[]} events A list of events to process
|
||||||
// types X Y Z to the timeline".
|
*/
|
||||||
this._addLiveEvent(events[i], duplicateStrategy);
|
Room.prototype.addEphemeralEvents = function(events) {
|
||||||
}
|
for (const event of events) {
|
||||||
|
if (event.getType() === 'm.typing') {
|
||||||
|
this.currentState.setTypingEvent(event);
|
||||||
|
} else if (event.getType() === 'm.receipt') {
|
||||||
|
this.addReceipt(event);
|
||||||
|
} // else ignore - life is too short for us to care about these events
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1245,10 +1245,8 @@ SyncApi.prototype._processSyncResponse = async function(
|
|||||||
room.setSummary(joinObj.summary);
|
room.setSummary(joinObj.summary);
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX: should we be adding ephemeralEvents to the timeline?
|
// we deliberately don't add ephemeral events to the timeline
|
||||||
// It feels like that for symmetry with room.addAccountData()
|
room.addEphemeralEvents(ephemeralEvents);
|
||||||
// there should be a room.addEphemeralEvents() or similar.
|
|
||||||
room.addLiveEvents(ephemeralEvents);
|
|
||||||
|
|
||||||
// we deliberately don't add accountData to the timeline
|
// we deliberately don't add accountData to the timeline
|
||||||
room.addAccountData(accountDataEvents);
|
room.addAccountData(accountDataEvents);
|
||||||
|
|||||||
Reference in New Issue
Block a user