mirror of
https://github.com/irislib/iris-messenger.git
synced 2024-10-18 06:03:22 +00:00
fix: do not save old follow lists
This commit is contained in:
parent
b5bdddc403
commit
1e0edbb497
@ -131,14 +131,12 @@ const Events = {
|
||||
this.likesByMessageId.get(id)?.add(event.pubkey);
|
||||
EventDB.insert(event);
|
||||
},
|
||||
handleFollow(event: Event) {
|
||||
const existing = EventDB.findOne({ kinds: [3], authors: [event.pubkey] });
|
||||
if (existing && existing.created_at >= event.created_at) {
|
||||
handleFollowList(event: Event) {
|
||||
const existing = SocialNetwork.followListTimestamps.get(ID(event.pubkey));
|
||||
if (existing && existing >= event.created_at) {
|
||||
return;
|
||||
}
|
||||
if (existing) {
|
||||
//EventDB.findAndRemove({ kinds: [3], authors: [event.pubkey] });
|
||||
}
|
||||
SocialNetwork.followListTimestamps.set(ID(event.pubkey), event.created_at);
|
||||
// no need to store follow events in memory because they're already in SocialNetwork.
|
||||
// when we start doing p2p, we can perhaps keep them in memory or just ask from dexie
|
||||
//EventDB.insert(event);
|
||||
@ -236,7 +234,7 @@ const Events = {
|
||||
if (existing) {
|
||||
//EventDB.findAndRemove({ authors: [event.pubkey], kinds: [0] });
|
||||
}
|
||||
// same as handleFollow, no need to store in memory for now
|
||||
// same as handleFollowList, no need to store in memory for now
|
||||
//EventDB.insert(event);
|
||||
const profile = JSON.parse(event.content);
|
||||
// if we have previously deleted our account, log out. appease app store.
|
||||
@ -510,7 +508,7 @@ const Events = {
|
||||
return false;
|
||||
}
|
||||
this.maybeAddNotification(event);
|
||||
this.handleFollow(event);
|
||||
this.handleFollowList(event);
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
|
@ -15,6 +15,7 @@ export default {
|
||||
followersByUser: new Map<UID, Set<UID>>(),
|
||||
blockedUsers: new Set<UID>(),
|
||||
flaggedUsers: new Set<UID>(),
|
||||
followListTimestamps: new Map<UID, number>(), // timestamp of last follow list update
|
||||
|
||||
isFollowing: function (follower: string, followedUser: string): boolean {
|
||||
const followedUserId = ID(followedUser);
|
||||
|
Loading…
Reference in New Issue
Block a user