added custom parentShortCid

This commit is contained in:
plebbitor
2023-04-17 10:20:35 +02:00
parent c5b7f67a22
commit a6a0e62ccf
2 changed files with 23 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
function findParentShortCid(parentCid, selectedFeed) {
for (const thread of selectedFeed) {
if (thread.cid === parentCid) {
return thread.shortCid;
}
if (thread.replyCount > 0 && thread.replies.pages.topAll.comments) {
const shortCid = findParentShortCid(parentCid, thread.replies.pages.topAll.comments);
if (shortCid) {
return shortCid;
}
}
}
return null;
}
export default findParentShortCid;