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

Fix incorrect prevEv being sent in ClientEvent.AccountData events (#2794)

This commit is contained in:
Michael Telatynski
2022-10-24 15:30:55 +01:00
committed by GitHub
parent ade2e81d3d
commit 9bdeea0a8d
3 changed files with 44 additions and 4 deletions

View File

@@ -208,7 +208,7 @@ class ExtensionAccountData implements Extension {
private processGlobalAccountData(globalAccountData: object[]): void {
const events = mapEvents(this.client, undefined, globalAccountData);
const prevEventsMap = events.reduce((m, c) => {
m[c.getId()] = this.client.store.getAccountData(c.getType());
m[c.getType()] = this.client.store.getAccountData(c.getType());
return m;
}, {});
this.client.store.storeAccountDataEvents(events);
@@ -222,7 +222,7 @@ class ExtensionAccountData implements Extension {
const rules = accountDataEvent.getContent<IPushRules>();
this.client.pushRules = PushProcessor.rewriteDefaultRules(rules);
}
const prevEvent = prevEventsMap[accountDataEvent.getId()];
const prevEvent = prevEventsMap[accountDataEvent.getType()];
this.client.emit(ClientEvent.AccountData, accountDataEvent, prevEvent);
return accountDataEvent;
},