-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Refactor threaded event tag building and interpreting logic so non-kind-1 events can reuse them #186
Conversation
…nd-1 events can reuse them
254d823
to
d19febd
Compare
@@ -150,11 +150,160 @@ public struct EventTag: RelayProviding, RelayURLValidating, Equatable { | |||
} | |||
} | |||
|
|||
public protocol EventTagInterpreting: NostrEvent {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused.
|
||
// Add the author "p" tag if it was not already added. | ||
if !tags.contains(where: { $0.name == TagName.pubkey.rawValue && $0.value == repliedEvent.pubkey }) { | ||
if let validatedRelayURL { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This specific logic around adding a relay to the p-tag is new. Which is why TextNoteEventTests
was updated to match the assertion. All the other logic here was copied from TextNoteEvent
.
// NIP-10 states that the first event tag is the root. | ||
return eventTags.first | ||
/// Events mentioned in the note content. | ||
@available(*, deprecated, message: "Deprecated in favor of referencedEventIds. Mention is an overloaded term from NIP-10.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIP-01 says
- The `e` tag, used to refer to an event: `["e", <32-bytes lowercase hex of the id of another event>, <recommended relay URL, optional>]`
Since this line uses the word refer
, I've called the new property referencedEventIds
.
@@ -36,88 +36,26 @@ public final class TextNoteEvent: NostrEvent, CustomEmojiInterpreting { | |||
try super.init(kind: .textNote, content: content, tags: tags, createdAt: createdAt, signedBy: keypair) | |||
} | |||
|
|||
/// Pubkeys mentioned in the note content. | |||
/// Pubkeys referenced in the note content. | |||
@available(*, deprecated, message: "Deprecated in favor of referencedPubkeys. Mention is an overloaded term from NIP-10.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIP-01 says
- The `p` tag, used to refer to another user: `["p", <32-bytes lowercase hex of a pubkey>, <recommended relay URL, optional>]`
Since this line uses the word refer
, I've called the new property referencedPubkeys
.
For example, NIP-17 - Private Direct Message uses threading, so this PR unblocks that work from happening.