mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2025-01-23 02:31:39 +01:00
Don't cache members that haven't been written yet - fixes #271
This commit is contained in:
parent
f5db6babf2
commit
6f37c232f7
@ -91,9 +91,6 @@ export class MemberWriter {
|
|||||||
});
|
});
|
||||||
if (memberEvent) {
|
if (memberEvent) {
|
||||||
member = RoomMember.fromMemberEvent(this._roomId, memberEvent);
|
member = RoomMember.fromMemberEvent(this._roomId, memberEvent);
|
||||||
// adding it to the cache, but not storing it for now;
|
|
||||||
// we'll do that when we get to the event
|
|
||||||
this._cache.set(member);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return member;
|
return member;
|
||||||
@ -222,5 +219,14 @@ export function tests() {
|
|||||||
assert.equal(change.member.membership, "join");
|
assert.equal(change.member.membership, "join");
|
||||||
assert.equal(txn.members.get(alice).displayName, "Alice");
|
assert.equal(txn.members.get(alice).displayName, "Alice");
|
||||||
},
|
},
|
||||||
|
"newly joined member causes a change with lookup done first": async assert => {
|
||||||
|
const event = createMemberEvent("join", alice, "Alice");
|
||||||
|
const writer = new MemberWriter(roomId);
|
||||||
|
const txn = createStorage();
|
||||||
|
const member = await writer.lookupSenderMember(event, [event], txn);
|
||||||
|
assert(member);
|
||||||
|
const change = await writer.writeTimelineMemberEvent(event, txn);
|
||||||
|
assert(change);
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user