Rename block to mute

Changelog-Changed: Rename block to mute
This commit is contained in:
William Casarin
2023-04-05 08:53:21 -07:00
parent 2ce0a771ea
commit 89b2382ad7
6 changed files with 33 additions and 33 deletions

View File

@@ -76,9 +76,9 @@ struct ContentView: View {
@State var profile_open: Bool = false @State var profile_open: Bool = false
@State var thread_open: Bool = false @State var thread_open: Bool = false
@State var search_open: Bool = false @State var search_open: Bool = false
@State var blocking: String? = nil @State var muting: String? = nil
@State var confirm_block: Bool = false @State var confirm_mute: Bool = false
@State var user_blocked_confirm: Bool = false @State var user_muted_confirm: Bool = false
@State var confirm_overwrite_mutelist: Bool = false @State var confirm_overwrite_mutelist: Bool = false
@State var current_boost: NostrEvent? = nil @State var current_boost: NostrEvent? = nil
@State var filter_state : FilterState = .posts_and_replies @State var filter_state : FilterState = .posts_and_replies
@@ -369,10 +369,10 @@ struct ContentView: View {
let target = notif.object as! ReportTarget let target = notif.object as! ReportTarget
self.active_sheet = .report(target) self.active_sheet = .report(target)
} }
.onReceive(handle_notify(.block)) { notif in .onReceive(handle_notify(.mute)) { notif in
let pubkey = notif.object as! String let pubkey = notif.object as! String
self.blocking = pubkey self.muting = pubkey
self.confirm_block = true self.confirm_mute = true
} }
.onReceive(handle_notify(.broadcast_event)) { obj in .onReceive(handle_notify(.broadcast_event)) { obj in
let ev = obj.object as! NostrEvent let ev = obj.object as! NostrEvent
@@ -474,23 +474,23 @@ struct ContentView: View {
notify(.logout, ()) notify(.logout, ())
} }
} }
.alert(NSLocalizedString("User blocked", comment: "Alert message to indicate the user has been blocked"), isPresented: $user_blocked_confirm, actions: { .alert(NSLocalizedString("User muted", comment: "Alert message to indicate the user has been muted"), isPresented: $user_muted_confirm, actions: {
Button(NSLocalizedString("Thanks!", comment: "Button to close out of alert that informs that the action to block a user was successful.")) { Button(NSLocalizedString("Thanks!", comment: "Button to close out of alert that informs that the action to muted a user was successful.")) {
user_blocked_confirm = false user_muted_confirm = false
} }
}, message: { }, message: {
if let pubkey = self.blocking { if let pubkey = self.muting {
let profile = damus_state!.profiles.lookup(id: pubkey) let profile = damus_state!.profiles.lookup(id: pubkey)
let name = Profile.displayName(profile: profile, pubkey: pubkey).username let name = Profile.displayName(profile: profile, pubkey: pubkey).username
Text("\(name) has been blocked", comment: "Alert message that informs a user was blocked.") Text("\(name) has been muted", comment: "Alert message that informs a user was muted.")
} else { } else {
Text("User has been blocked", comment: "Alert message that informs a user was blocked.") Text("User has been muted", comment: "Alert message that informs a user was d.")
} }
}) })
.alert(NSLocalizedString("Create new mutelist", comment: "Title of alert prompting the user to create a new mutelist."), isPresented: $confirm_overwrite_mutelist, actions: { .alert(NSLocalizedString("Create new mutelist", comment: "Title of alert prompting the user to create a new mutelist."), isPresented: $confirm_overwrite_mutelist, actions: {
Button(NSLocalizedString("Cancel", comment: "Button to cancel out of alert that creates a new mutelist.")) { Button(NSLocalizedString("Cancel", comment: "Button to cancel out of alert that creates a new mutelist.")) {
confirm_overwrite_mutelist = false confirm_overwrite_mutelist = false
confirm_block = false confirm_mute = false
} }
Button(NSLocalizedString("Yes, Overwrite", comment: "Text of button that confirms to overwrite the existing mutelist.")) { Button(NSLocalizedString("Yes, Overwrite", comment: "Text of button that confirms to overwrite the existing mutelist.")) {
@@ -502,7 +502,7 @@ struct ContentView: View {
return return
} }
guard let pubkey = blocking else { guard let pubkey = muting else {
return return
} }
@@ -514,17 +514,17 @@ struct ContentView: View {
ds.postbox.send(mutelist) ds.postbox.send(mutelist)
confirm_overwrite_mutelist = false confirm_overwrite_mutelist = false
confirm_block = false confirm_mute = false
user_blocked_confirm = true user_muted_confirm = true
} }
}, message: { }, message: {
Text("No block list found, create a new one? This will overwrite any previous block lists.", comment: "Alert message prompt that asks if the user wants to create a new block list, overwriting previous block lists.") Text("No mute list found, create a new one? This will overwrite any previous mute lists.", comment: "Alert message prompt that asks if the user wants to create a new mute list, overwriting previous mute lists.")
}) })
.alert(NSLocalizedString("Block User", comment: "Title of alert for blocking a user."), isPresented: $confirm_block, actions: { .alert(NSLocalizedString("Mute User", comment: "Title of alert for muting a user."), isPresented: $confirm_mute, actions: {
Button(NSLocalizedString("Cancel", comment: "Alert button to cancel out of alert for blocking a user."), role: .cancel) { Button(NSLocalizedString("Cancel", comment: "Alert button to cancel out of alert for muting a user."), role: .cancel) {
confirm_block = false confirm_mute = false
} }
Button(NSLocalizedString("Block", comment: "Alert button to block a user."), role: .destructive) { Button(NSLocalizedString("Mute", comment: "Alert button to mute a user."), role: .destructive) {
guard let ds = damus_state else { guard let ds = damus_state else {
return return
} }
@@ -535,7 +535,7 @@ struct ContentView: View {
guard let keypair = ds.keypair.to_full() else { guard let keypair = ds.keypair.to_full() else {
return return
} }
guard let pubkey = blocking else { guard let pubkey = muting else {
return return
} }
@@ -547,12 +547,12 @@ struct ContentView: View {
} }
} }
}, message: { }, message: {
if let pubkey = blocking { if let pubkey = muting {
let profile = damus_state?.profiles.lookup(id: pubkey) let profile = damus_state?.profiles.lookup(id: pubkey)
let name = Profile.displayName(profile: profile, pubkey: pubkey).username let name = Profile.displayName(profile: profile, pubkey: pubkey).username
Text("Block \(name)?", comment: "Alert message prompt to ask if a user should be blocked.") Text("Mute \(name)?", comment: "Alert message prompt to ask if a user should be muted.")
} else { } else {
Text("Could not find user to block...", comment: "Alert message to indicate that the blocked user could not be found.") Text("Could not find user to mute...", comment: "Alert message to indicate that the muted user could not be found.")
} }
}) })
.alert(NSLocalizedString("Repost", comment: "Title of alert for confirming to repost a post."), isPresented: $current_boost.mappedToBool()) { .alert(NSLocalizedString("Repost", comment: "Title of alert for confirming to repost a post."), isPresented: $current_boost.mappedToBool()) {

View File

@@ -86,8 +86,8 @@ extension Notification.Name {
static var report: Notification.Name { static var report: Notification.Name {
return Notification.Name("report") return Notification.Name("report")
} }
static var block: Notification.Name { static var mute: Notification.Name {
return Notification.Name("block") return Notification.Name("mute")
} }
static var new_mutes: Notification.Name { static var new_mutes: Notification.Name {
return Notification.Name("new_mutes") return Notification.Name("new_mutes")

View File

@@ -102,9 +102,9 @@ struct MenuItems: View {
} }
Button(role: .destructive) { Button(role: .destructive) {
notify(.block, target_pubkey) notify(.mute, target_pubkey)
} label: { } label: {
Label(NSLocalizedString("Block", comment: "Context menu option for blocking users."), systemImage: "exclamationmark.octagon") Label(NSLocalizedString("Mute", comment: "Context menu option for muting users."), systemImage: "exclamationmark.octagon")
} }
} }
} }

View File

@@ -43,7 +43,7 @@ struct MutelistView: View {
RemoveAction(pubkey: pubkey) RemoveAction(pubkey: pubkey)
} }
} }
.navigationTitle(NSLocalizedString("Blocked Users", comment: "Navigation title of view to see list of blocked users.")) .navigationTitle(NSLocalizedString("Muted Users", comment: "Navigation title of view to see list of muted users."))
} }
} }

View File

@@ -221,8 +221,8 @@ struct ProfileView: View {
notify(.report, target) notify(.report, target)
} }
Button(NSLocalizedString("Block", comment: "Button to block a profile."), role: .destructive) { Button(NSLocalizedString("Mute", comment: "Button to mute a profile."), role: .destructive) {
notify(.block, profile.pubkey) notify(.mute, profile.pubkey)
} }
} }
} }

View File

@@ -93,7 +93,7 @@ struct SideMenuView: View {
*/ */
NavigationLink(destination: MutelistView(damus_state: damus_state, users: get_mutelist_users(damus_state.contacts.mutelist) )) { NavigationLink(destination: MutelistView(damus_state: damus_state, users: get_mutelist_users(damus_state.contacts.mutelist) )) {
navLabel(title: NSLocalizedString("Blocked", comment: "Sidebar menu label for Profile view."), systemImage: "exclamationmark.octagon") navLabel(title: NSLocalizedString("Muted", comment: "Sidebar menu label for muted users view."), systemImage: "exclamationmark.octagon")
} }
NavigationLink(destination: RelayConfigView(state: damus_state)) { NavigationLink(destination: RelayConfigView(state: damus_state)) {