feed: dirty fix to show replies
now that nonce tag is always the first element in the tags list, a bug surfaced that replies from nostrweb did not render anymore. reason was that the code expected the first tag to be an e tag and took its reply-id. this commit is a quick fix that takes the first reply-id from the first e tag. the proper way is a bit more complicated as nip-10 defines a preferred and deprecated way. this is a quick and dirty fix so that replies work with nip-13 pow events, but nip-10 event tags should be properly supported but in a later commit.pull/55/head
parent
d5e9ef18c7
commit
a596121821
|
@ -484,7 +484,7 @@ function handleReply(evt, relay) {
|
|||
}
|
||||
|
||||
function renderReply(evt, relay) {
|
||||
const eventId = evt.tags[0][1]; // TODO: double check
|
||||
const eventId = evt.tags.filter(hasEventTag)[0][1]; // TODO: should check for 'reply' marker with fallback to 'root' marker or last 'e' tag, see nip-10
|
||||
const article = feedDomMap[eventId] || replyDomMap[eventId];
|
||||
if (!article) { // root article has not been rendered
|
||||
return;
|
||||
|
@ -687,7 +687,7 @@ function getMetadata(evt, relay) {
|
|||
title: `${userName} on ${host} ${userAbout}`,
|
||||
}) : elemCanvas(evt.pubkey);
|
||||
const isReply = evt.tags.some(hasEventTag);
|
||||
const replies = replyList.filter((reply) => reply.tags[0][1] === evt.id);
|
||||
const replies = replyList.filter(({tags}) => tags.filter(hasEventTag).some(reply => reply[1] === evt.id)); // TODO: nip-10
|
||||
const time = new Date(evt.created_at * 1000);
|
||||
return {host, img, isReply, name, replies, time, userName};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue