mute: migrating muted_threads to new mute list

This patch depends on: Adding ability to mute hashtag from SearchView

This is the last patch for the new mute list feature

- Removing MutedThreadsManager
- Adding system to migrate existing muted threads to new mute list

Closes: https://github.com/damus-io/damus/issues/1718
Closes: 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:
Charlie Fish
2024-01-17 18:17:43 -07:00
committed by William Casarin
parent ace8a7081b
commit f341a37902
15 changed files with 37 additions and 81 deletions

View File

@@ -27,7 +27,7 @@ struct EventMutingContainerView<Content: View>: View {
self.damus_state = damus_state
self.event = event
self.content = content()
self._shown = State(initialValue: should_show_event(keypair: damus_state.keypair, hellthreads: damus_state.muted_threads, contacts: damus_state.contacts, ev: event))
self._shown = State(initialValue: should_show_event(contacts: damus_state.contacts, ev: event))
}
init(damus_state: DamusState, event: NostrEvent, muteBox: @escaping MuteBoxViewClosure, @ViewBuilder content: () -> Content) {
@@ -36,7 +36,7 @@ struct EventMutingContainerView<Content: View>: View {
}
var should_mute: Bool {
return !should_show_event(keypair: damus_state.keypair, hellthreads: damus_state.muted_threads, contacts: damus_state.contacts, ev: event)
return !should_show_event(contacts: damus_state.contacts, ev: event)
}
var body: some View {

View File

@@ -59,7 +59,8 @@ struct SearchHomeView: View {
return false
}
if damus_state.muted_threads.isMutedThread(ev, keypair: self.damus_state.keypair) {
let event_muted = damus_state.contacts.mutelist?.mute_list?.event_muted_reason(ev) != nil
if event_muted {
return false
}