Make tags more unique
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import {ctx, remove, nthEq} from "@welshman/lib"
|
||||
import {ctx, uniq, remove, nthEq} from "@welshman/lib"
|
||||
import {
|
||||
getAddress,
|
||||
isReplaceable,
|
||||
@@ -36,7 +36,7 @@ export const tagEvent = (event: TrustedEvent, mark = "") => {
|
||||
}
|
||||
|
||||
export const tagEventPubkeys = (event: TrustedEvent) =>
|
||||
remove(pubkey.get()!, [event.pubkey, ...getPubkeyTagValues(event.tags)]).map(tagPubkey)
|
||||
uniq(remove(pubkey.get()!, [event.pubkey, ...getPubkeyTagValues(event.tags)])).map(tagPubkey)
|
||||
|
||||
export const tagEventForQuote = (event: TrustedEvent) => [
|
||||
"q",
|
||||
|
||||
@@ -103,6 +103,6 @@ export const getReplyTags = (tags: string[][]) => {
|
||||
export const getReplyTagValues = (tags: string[][]) =>
|
||||
mapVals(tags => tags.map(nth(1)), getReplyTags(tags))
|
||||
|
||||
export const uniqTags = (tags: string[][]) => uniqBy(t => t.join(":"), tags)
|
||||
export const uniqTags = (tags: string[][]) => uniqBy(t => t.slice(0, 2).join(":"), tags)
|
||||
|
||||
export const tagsFromIMeta = (imeta: string[]) => imeta.map((m: string) => m.split(" "))
|
||||
|
||||
Reference in New Issue
Block a user