1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-29 16:43:09 +03:00

make the tests pass again

This commit is contained in:
Matthew Hodgson
2016-08-30 23:34:11 +01:00
parent e18b446190
commit d25d60f0f0
4 changed files with 61 additions and 52 deletions

View File

@@ -217,7 +217,7 @@ EventTimeline.prototype.setNeighbouringTimeline = function(neighbour, direction)
EventTimeline.prototype.addEvent = function(event, atStart) {
var stateContext = atStart ? this._startState : this._endState;
setEventMetadata(event, stateContext, atStart);
EventTimeline.setEventMetadata(event, stateContext, atStart);
// modify state
if (event.isState()) {
@@ -233,7 +233,7 @@ EventTimeline.prototype.addEvent = function(event, atStart) {
// member event, whereas we want to set the .sender value for the ACTUAL
// member event itself.
if (!event.sender || (event.getType() === "m.room.member" && !atStart)) {
setEventMetadata(event, stateContext, atStart);
EventTimeline.setEventMetadata(event, stateContext, atStart);
}
}
@@ -251,7 +251,10 @@ EventTimeline.prototype.addEvent = function(event, atStart) {
}
};
function setEventMetadata(event, stateContext, toStartOfTimeline) {
/**
* Static helper method to set sender and target properties
*/
EventTimeline.setEventMetadata = function(event, stateContext, toStartOfTimeline) {
// set sender and target properties
event.sender = stateContext.getSentinelMember(
event.getSender()