On May 24, 2024, at 18:09, Daniel D'Aquino <dan...@daquino.me> wrote:On May 24, 2024, at 16:54, William Casarin <jb...@jb55.com> wrote:On Fri, May 24, 2024 at 10:58:59PM GMT, Daniel D’Aquino wrote:Testing
--------
PASS
Device: iPhone 15 simulator
iOS: 17.4
Damus: This commit
Steps:
1. Mute a specific user "A" from account "B"
2. Make account "B" follow account "C"
3. Using a separate account "C", repost a note from account "A"
4. Make sure that the reposted note from step 3 does not appear on account "B"'s timeline
5. Make sure other reposts of other users still show normally
Closes: https://github.com/damus-io/damus/issues/1934
Changelog-Changed: Do not show reposts of muted events
Signed-off-by: Daniel D’Aquino <dan...@daquino.me>
---
damus/Models/MutelistManager.swift | 5 +++++
nostrdb/NdbNote.swift | 13 +++++++++++++
2 files changed, 18 insertions(+)
[..]
diff --git a/nostrdb/NdbNote.swift b/nostrdb/NdbNote.swift
index ce2f358f..445196e2 100644
--- a/nostrdb/NdbNote.swift
+++ b/nostrdb/NdbNote.swift
@@ -272,6 +272,19 @@ class NdbNote: Encodable, Equatable, Hashable {
func get_inner_event() -> NdbNote? {
return self.inner_event
}
+
+ func get_inner_event(ndb: Ndb) -> NdbNote? {
+ guard self.known_kind == .boost else {
+ return nil
+ }
+
+ if let id = self.referenced_ids.first {
+ guard let note_key = ndb.lookup_note_key(id) else { return nil }
+ return ndb.lookup_note_by_key(note_key)?.unsafeUnownedValue?.to_owned()
+ }
my only concern here is that this is pretty inefficient, ideally if we
are copying notes into memory it would not be a one-off things.
Since this is a temporary, instead of doing to_owned we can just return
NdbTxn<NdbNote>. This way we won't need a copy and you can refer to the
n ote data within nostrdb:
func get_inner_event(ndb: Ndb) -> NdbTxn<NdbNote>? {
guard self.known_kind == .boost else {
return nil
}
if let id = self.referenced_ids.first {
guard let note_key = ndb.lookup_note_key(id) else { return nil }
return ndb.lookup_note_by_key(note_key).collect()
}
return nil
}
// ...
if let inner_event = ev.get_inner_event(ndb: self.ndb) {
return self.compute_event_muted_reason(inner_event.unsafeUnownedValue)
}I see! v3 coming up soon!