commit 94a29e2c2fbb14adc37bb81bda20e81b475ec734
parent 5f64f54ef581481c7c3f2033a5bf3290cf5f910a
Author: Joshua Jiang <zhuoshengjiang@gmail.com>
Date: Sat, 29 Apr 2023 18:09:53 -0700
Add unmute option in profile view
Changelog-Added: Add unmute option in profile view
Closes: #1050
Diffstat:
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/damus/Views/Muting/MutelistView.swift b/damus/Views/Muting/MutelistView.swift
@@ -44,6 +44,9 @@ struct MutelistView: View {
}
}
.navigationTitle(NSLocalizedString("Muted Users", comment: "Navigation title of view to see list of muted users."))
+ .onAppear {
+ users = get_mutelist_users(damus_state.contacts.mutelist)
+ }
}
}
diff --git a/damus/Views/Profile/ProfileView.swift b/damus/Views/Profile/ProfileView.swift
@@ -205,8 +205,26 @@ struct ProfileView: View {
notify(.report, target)
}
- Button(NSLocalizedString("Mute", comment: "Button to mute a profile."), role: .destructive) {
- notify(.mute, profile.pubkey)
+ if damus_state.contacts.is_muted(profile.pubkey) {
+ Button(NSLocalizedString("Unmute", comment: "Button to unmute a profile.")) {
+ guard
+ let keypair = damus_state.keypair.to_full(),
+ let mutelist = damus_state.contacts.mutelist
+ else {
+ return
+ }
+
+ guard let new_ev = remove_from_mutelist(keypair: keypair, prev: mutelist, to_remove: profile.pubkey) else {
+ return
+ }
+
+ damus_state.contacts.set_mutelist(new_ev)
+ damus_state.postbox.send(new_ev)
+ }
+ } else {
+ Button(NSLocalizedString("Mute", comment: "Button to mute a profile."), role: .destructive) {
+ notify(.mute, profile.pubkey)
+ }
}
}
}