feat: display mentions as replies (I don't know what's the difference)

This commit is contained in:
Ayo 2023-09-29 12:52:15 +02:00
parent 10238efb58
commit 78f81c02eb

View file

@ -3,7 +3,8 @@ export function renderMentions(mentions, rootSelector) {
mentions = mentions.filter((m) => m["wm-private"] !== true); mentions = mentions.filter((m) => m["wm-private"] !== true);
if (mentions.filter((m) => m.author.name !== "Ayo Ayco").length) if (mentions.filter((m) => m.author.name !== "Ayo Ayco").length)
webMentionsSection.innerHTML = "<h2 id='webmentions'>From Across the Web</h2>"; webMentionsSection.innerHTML =
"<h2 id='webmentions'>From Across the Web</h2>";
const heading = { const heading = {
"like-of": "👍 {x} Likes", "like-of": "👍 {x} Likes",
@ -13,7 +14,7 @@ export function renderMentions(mentions, rootSelector) {
"in-reply-to": "💬 {x} Replies", "in-reply-to": "💬 {x} Replies",
}; };
["like-of", "repost-of", "bookmark-of", "mention-of"].forEach((type) => { ["like-of", "repost-of", "bookmark-of"].forEach((type) => {
const mentionsOfType = mentions const mentionsOfType = mentions
.filter((m) => m.author.name !== "Ayo Ayco") .filter((m) => m.author.name !== "Ayo Ayco")
.filter((m) => m["wm-property"] === type); .filter((m) => m["wm-property"] === type);
@ -24,7 +25,7 @@ export function renderMentions(mentions, rootSelector) {
} }
}); });
["in-reply-to"].forEach((type) => { ["in-reply-to", "mention-of"].forEach((type) => {
const replies = mentions.filter((m) => m["wm-property"] === type); const replies = mentions.filter((m) => m["wm-property"] === type);
if (replies.length) { if (replies.length) {