From b3271ed5f20f2971301241494e4e5a8e8d5b9433 Mon Sep 17 00:00:00 2001 From: Ayo Ayco Date: Sun, 5 May 2024 10:14:01 +0200 Subject: [PATCH] feat: only hide author like, boost, bookmark --- assets/js/webmention-utils.mjs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/assets/js/webmention-utils.mjs b/assets/js/webmention-utils.mjs index f1fb8ed..7fea49e 100644 --- a/assets/js/webmention-utils.mjs +++ b/assets/js/webmention-utils.mjs @@ -1,8 +1,14 @@ export function renderMentions(mentions, rootSelector, ignoreAuthorUrls = []) { const webMentionsSection = document.querySelector(rootSelector); + const engagementTypes = ["like-of", "repost-of", "bookmark-of"]; mentions = mentions.filter( - (m) => m["wm-private"] !== true && !ignoreAuthorUrls.includes(m.author.url) + (m) => + m["wm-private"] !== true && + !( + ignoreAuthorUrls.includes(m.author.url) && + engagementTypes.includes(m["wm-property"]) + ) ); if (mentions.length) { @@ -17,7 +23,7 @@ export function renderMentions(mentions, rootSelector, ignoreAuthorUrls = []) { "in-reply-to": "💬 {x} Replies", }; - ["like-of", "repost-of", "bookmark-of"].forEach((type) => { + engagementTypes.forEach((type) => { const mentionsOfType = mentions.filter((m) => m["wm-property"] === type); if (mentionsOfType.length) {