Add unmute option in profile view
Changelog-Added: Add unmute option in profile view Closes: #1050
This commit is contained in:
committed by
William Casarin
parent
5f64f54ef5
commit
94a29e2c2f
@@ -44,6 +44,9 @@ struct MutelistView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.navigationTitle(NSLocalizedString("Muted Users", comment: "Navigation title of view to see list of muted users."))
|
.navigationTitle(NSLocalizedString("Muted Users", comment: "Navigation title of view to see list of muted users."))
|
||||||
|
.onAppear {
|
||||||
|
users = get_mutelist_users(damus_state.contacts.mutelist)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -205,8 +205,26 @@ struct ProfileView: View {
|
|||||||
notify(.report, target)
|
notify(.report, target)
|
||||||
}
|
}
|
||||||
|
|
||||||
Button(NSLocalizedString("Mute", comment: "Button to mute a profile."), role: .destructive) {
|
if damus_state.contacts.is_muted(profile.pubkey) {
|
||||||
notify(.mute, 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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user