Skip to content

Commit

Permalink
Merge pull request #1837 from matrix-org/dbkr/fix_blank_membership_ev…
Browse files Browse the repository at this point in the history
…ents

Fix blank profile in join events
  • Loading branch information
dbkr authored Aug 10, 2021
2 parents 264636c + 2375b00 commit 7dbee19
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/models/event-timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,15 @@ export class EventTimeline {
* @param {boolean} toStartOfTimeline if true the event's forwardLooking flag is set false
*/
static setEventMetadata(event: MatrixEvent, stateContext: RoomState, toStartOfTimeline: boolean): void {
// We always check if the event doesn't already have the property. We do
// this to avoid overriding non-sentinel members by sentinel ones when
// adding the event to a filtered timeline
if (!event.sender) {
// When we try to generate a sentinel member before we have that member
// in the members object, we still generate a sentinel but it doesn't
// have a membership event, so test to see if events.member is set. We
// check this to avoid overriding non-sentinel members by sentinel ones
// when adding the event to a filtered timeline
if (!event.sender?.events?.member) {
event.sender = stateContext.getSentinelMember(event.getSender());
}
if (!event.target && event.getType() === EventType.RoomMember) {
if (!event.target?.events?.member && event.getType() === EventType.RoomMember) {
event.target = stateContext.getSentinelMember(event.getStateKey());
}

Expand Down

0 comments on commit 7dbee19

Please sign in to comment.