mute: migrate Lists.swift to use new MuteItem
This patch depends on: Adding new structs/enums for new mute list
- Rewrites Lists.swift to use new mute list option
- This leads to a lot of changes for changing the type from RefId to the new MuteItem
- Update & relay new mute list in AddMuteItemView.swift (fixing previous patch TODO)
- Renames `list` to `list_deprecated`
- We need to keep this since existing users might have an old mute list
Related: https://github.com/damus-io/damus/issues/1718
Related: https://github.com/damus-io/damus/issues/856
Lighting Address: fishcharlie@strike.me
Signed-off-by: Charlie Fish <contact@charlie.fish>
Reviewed-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
committed by
William Casarin
parent
9f332a148f
commit
0f05123ef8
@@ -72,7 +72,19 @@ struct AddMuteItemView: View {
|
||||
}
|
||||
}()
|
||||
|
||||
// @TODO: in future patch - actually update & relay the new mute list
|
||||
// Actually update & relay the new mute list
|
||||
if let mute_item {
|
||||
guard
|
||||
let full_keypair = state.keypair.to_full(),
|
||||
let existing_mutelist = state.contacts.mutelist,
|
||||
let mutelist = create_or_update_mutelist(keypair: full_keypair, mprev: existing_mutelist, to_add: mute_item)
|
||||
else {
|
||||
return
|
||||
}
|
||||
|
||||
state.contacts.set_mutelist(mutelist)
|
||||
state.postbox.send(mutelist)
|
||||
}
|
||||
|
||||
new_text = ""
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ struct MutelistView: View {
|
||||
let keypair = damus_state.keypair.to_full(),
|
||||
let new_ev = remove_from_mutelist(keypair: keypair,
|
||||
prev: mutelist,
|
||||
to_remove: .pubkey(pubkey))
|
||||
to_remove: .user(pubkey, nil))
|
||||
else {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ struct ProfileView: View {
|
||||
return
|
||||
}
|
||||
|
||||
guard let new_ev = remove_from_mutelist(keypair: keypair, prev: mutelist, to_remove: .pubkey(profile.pubkey)) else {
|
||||
guard let new_ev = remove_from_mutelist(keypair: keypair, prev: mutelist, to_remove: .user(profile.pubkey, nil)) else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user