damus
damus copied to clipboard
delete like
@jb55
To add a like, you are appending the id and pubkey to tags and passing it, to delete a like, we get the tags and remove the previously added like id and pubkey from the array and push the update? Or its a completely different way of doing it?
func make_like_event(pubkey: String, privkey: String, liked: NostrEvent) -> NostrEvent {
var tags: [[String]] = liked.tags.filter { tag in tag.count >= 2 && (tag[0] == "e" || tag[0] == "p") }
tags.append(["e", liked.id])
tags.append(["p", liked.pubkey])
debugPrint("like event", liked)
let ev = NostrEvent(content: "", pubkey: pubkey, kind: 7, tags: tags)
ev.calculate_id()
ev.sign(privkey: privkey)
return ev
}
Like deletion is implemented in Damus web, its just a kind5 note referencing the original like
Also see #387