fix chat listing

This commit is contained in:
Martti Malmi 2023-06-19 09:26:41 +03:00
parent 2d0ca9bc30
commit 706ea9ebce

View File

@ -759,9 +759,12 @@ const Events = {
unsub2();
};
},
getDirectMessages(): Unsubscribe {
const unsub1 = PubSub.subscribe({ kinds: [4], '#p': [Key.getPubKey()] });
const unsub2 = PubSub.subscribe({ kinds: [4], authors: [Key.getPubKey()] });
getDirectMessages(cb?: (chats: Map<string, SortedLimitedEventSet>) => void): Unsubscribe {
const callback = () => {
cb?.(this.directMessagesByUser ?? new Map());
};
const unsub1 = PubSub.subscribe({ kinds: [4], '#p': [Key.getPubKey()] }, callback);
const unsub2 = PubSub.subscribe({ kinds: [4], authors: [Key.getPubKey()] }, callback);
return () => {
unsub1();
unsub2();