refactor: should_hide_event -> should_show_event
This commit is contained in:
@@ -464,7 +464,7 @@ class HomeModel: ObservableObject {
|
||||
}
|
||||
|
||||
func handle_text_event(sub_id: String, _ ev: NostrEvent) {
|
||||
if should_hide_event(contacts: damus_state.contacts, ev: ev) {
|
||||
guard should_show_event(contacts: damus_state.contacts, ev: ev) else {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -781,10 +781,10 @@ func event_has_our_pubkey(_ ev: NostrEvent, our_pubkey: String) -> Bool {
|
||||
}
|
||||
|
||||
|
||||
func should_hide_event(contacts: Contacts, ev: NostrEvent) -> Bool {
|
||||
func should_show_event(contacts: Contacts, ev: NostrEvent) -> Bool {
|
||||
if contacts.is_muted(ev.pubkey) {
|
||||
return true
|
||||
return false
|
||||
}
|
||||
return !ev.should_show_event
|
||||
return ev.should_show_event
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ class SearchHomeModel: ObservableObject {
|
||||
}
|
||||
|
||||
func filter_muted() {
|
||||
events = events.filter { !should_hide_event(contacts: damus_state.contacts, ev: $0) }
|
||||
events = events.filter { should_show_event(contacts: damus_state.contacts, ev: $0) }
|
||||
}
|
||||
|
||||
func subscribe() {
|
||||
@@ -54,7 +54,7 @@ class SearchHomeModel: ObservableObject {
|
||||
guard sub_id == self.base_subid || sub_id == self.profiles_subid else {
|
||||
return
|
||||
}
|
||||
if ev.is_textlike && !should_hide_event(contacts: damus_state.contacts, ev: ev) && !ev.is_reply(nil) {
|
||||
if ev.is_textlike && should_show_event(contacts: damus_state.contacts, ev: ev) && !ev.is_reply(nil) {
|
||||
if seen_pubkey.contains(ev.pubkey) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -25,11 +25,11 @@ struct MutedEventView: View {
|
||||
self.selected = selected
|
||||
self._nav_target = nav_target
|
||||
self._navigating = navigating
|
||||
self._shown = State(initialValue: !should_hide_event(contacts: damus_state.contacts, ev: event))
|
||||
self._shown = State(initialValue: should_show_event(contacts: damus_state.contacts, ev: event))
|
||||
}
|
||||
|
||||
var should_mute: Bool {
|
||||
return should_hide_event(contacts: damus_state.contacts, ev: event)
|
||||
return !should_show_event(contacts: damus_state.contacts, ev: event)
|
||||
}
|
||||
|
||||
var FillColor: Color {
|
||||
|
||||
Reference in New Issue
Block a user