1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

Set the updated .sender and .target props on the event when the event itself updates these props.

This commit is contained in:
Kegan Dougal
2016-01-11 17:35:46 +00:00
parent 51fe73bc27
commit e8f77256de

View File

@@ -250,8 +250,10 @@ Room.prototype.addEventsToTimeline = function(events, toStartOfTimeline) {
stateContext.setStateEvents([events[i]]); stateContext.setStateEvents([events[i]]);
// it is possible that the act of setting the state event means we // it is possible that the act of setting the state event means we
// can set more metadata (specifically sender/target props), so try // can set more metadata (specifically sender/target props), so try
// it again if the prop wasn't previously set. // it again if the prop wasn't previously set. It may also mean that
if (!events[i].sender) { // the sender/target is updated (if the event set was a room member event)
// so we want to use the *updated* member (new avatar/name) instead.
if (!events[i].sender || events[i].getType() === "m.room.member") {
setEventMetadata(events[i], stateContext, toStartOfTimeline); setEventMetadata(events[i], stateContext, toStartOfTimeline);
} }
} }