commit 9eb39f7e0a4f46c37cf0cbd4eca5bda3e7d3bd25
parent 173b22b772104f9159091d3b0fc9be26ec0df433
Author: ericholguin <eric.holguinsanchez@gmail.com>
Date: Sat, 14 Jan 2023 13:06:53 -0700
Don't blur images if your friend boosted it
Closes: #322
Changelog-Changed: Don't blur images if your friend boosted it
Diffstat:
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/damus/Views/EventView.swift b/damus/Views/EventView.swift
@@ -175,7 +175,7 @@ struct EventView: View {
Reposted(damus: damus, pubkey: event.pubkey, profile: prof)
}
.buttonStyle(PlainButtonStyle())
- TextEvent(inner_ev, pubkey: inner_ev.pubkey)
+ TextEvent(inner_ev, pubkey: inner_ev.pubkey, booster_pubkey: event.pubkey)
.padding([.top], 1)
}
} else {
@@ -185,7 +185,7 @@ struct EventView: View {
}
}
- func TextEvent(_ event: NostrEvent, pubkey: String) -> some View {
+ func TextEvent(_ event: NostrEvent, pubkey: String, booster_pubkey: String? = nil) -> some View {
let content = event.get_content(damus.keypair.privkey)
return HStack(alignment: .top) {
@@ -232,7 +232,7 @@ struct EventView: View {
.frame(maxWidth: .infinity, alignment: .leading)
}
- let should_show_img = should_show_images(contacts: damus.contacts, ev: event, our_pubkey: damus.pubkey)
+ let should_show_img = should_show_images(contacts: damus.contacts, ev: event, our_pubkey: damus.pubkey, booster_pubkey: booster_pubkey)
NoteContentView(privkey: damus.keypair.privkey, event: event, profiles: damus.profiles, previews: damus.previews, show_images: should_show_img, artifacts: .just_content(content), size: self.size)
.frame(maxWidth: .infinity, alignment: .leading)
@@ -276,13 +276,16 @@ struct EventView: View {
}
// blame the porn bots for this code
-func should_show_images(contacts: Contacts, ev: NostrEvent, our_pubkey: String) -> Bool {
+func should_show_images(contacts: Contacts, ev: NostrEvent, our_pubkey: String, booster_pubkey: String? = nil) -> Bool {
if ev.pubkey == our_pubkey {
return true
}
if contacts.is_in_friendosphere(ev.pubkey) {
return true
}
+ if let boost_key = booster_pubkey, contacts.is_in_friendosphere(boost_key) {
+ return true
+ }
return false
}