feat: only hide author like, boost, bookmark

This commit is contained in:
Ayo Ayco 2024-05-05 10:14:01 +02:00
parent c295a7cf90
commit b3271ed5f2

View file

@ -1,8 +1,14 @@
export function renderMentions(mentions, rootSelector, ignoreAuthorUrls = []) { export function renderMentions(mentions, rootSelector, ignoreAuthorUrls = []) {
const webMentionsSection = document.querySelector(rootSelector); const webMentionsSection = document.querySelector(rootSelector);
const engagementTypes = ["like-of", "repost-of", "bookmark-of"];
mentions = mentions.filter( 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) { if (mentions.length) {
@ -17,7 +23,7 @@ export function renderMentions(mentions, rootSelector, ignoreAuthorUrls = []) {
"in-reply-to": "💬 {x} Replies", "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); const mentionsOfType = mentions.filter((m) => m["wm-property"] === type);
if (mentionsOfType.length) { if (mentionsOfType.length) {