mute: integrate new MutelistManager

This patch is slightly large (I think still within the guidelines tho) ,
but also pretty straightforward. I thought for a while about how I could
split this up in a straightforward way, and I couldn’t come up with
anything without breaking intermediate builds.

- Deleted a lot of old/unnecessary code (ie. the Collection extension
  for MuteItem, since we’re now using the MutelistManager sets)

- Changed damus_state.contacts to damus_state.mutelist_manager for all
  mute list manager work

- Updated MutelistView to take advantage of new code (this is probably
  the largest change in this patch)

Lighting-Address: fishcharlie@strike.me
Signed-off-by: Charlie Fish <contact@charlie.fish>
Reviewed-by: William Casarin <jb55@jb55.com>
Link: 20240210163650.42884-4-contact@charlie.fish
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
Charlie Fish
2024-02-10 09:36:48 -07:00
committed by William Casarin
parent a9baef7a21
commit 1d4d2b0204
24 changed files with 123 additions and 201 deletions

View File

@@ -550,7 +550,7 @@ struct ContentView: View {
return
}
ds.contacts.set_mutelist(mutelist)
ds.mutelist_manager.set_mutelist(mutelist)
ds.postbox.send(mutelist)
confirm_overwrite_mutelist = false
@@ -569,7 +569,7 @@ struct ContentView: View {
return
}
if ds.contacts.mutelist == nil {
if ds.mutelist_manager.event == nil {
confirm_overwrite_mutelist = true
} else {
guard let keypair = ds.keypair.to_full(),
@@ -578,11 +578,11 @@ struct ContentView: View {
return
}
guard let ev = create_or_update_mutelist(keypair: keypair, mprev: ds.contacts.mutelist, to_add: muting) else {
guard let ev = create_or_update_mutelist(keypair: keypair, mprev: ds.mutelist_manager.event, to_add: muting) else {
return
}
ds.contacts.set_mutelist(ev)
ds.mutelist_manager.set_mutelist(ev)
ds.postbox.send(ev)
}
}
@@ -660,6 +660,7 @@ struct ContentView: View {
likes: EventCounter(our_pubkey: pubkey),
boosts: EventCounter(our_pubkey: pubkey),
contacts: Contacts(our_pubkey: pubkey),
mutelist_manager: MutelistManager(),
profiles: Profiles(ndb: ndb),
dms: home.dms,
previews: PreviewCache(),