From ac774fdff95d40b78c6cee71f523d1fb46ec7b9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Sun, 21 May 2023 15:55:14 -0400 Subject: [PATCH] https://github.com/NodeBB/NodeBB/issues/11618 --- lib/css-builders.ts | 1 + lib/parse.ts | 14 ++++++++++++++ plugin.json | 1 + 3 files changed, 16 insertions(+) diff --git a/lib/css-builders.ts b/lib/css-builders.ts index 85bab09..734ba25 100644 --- a/lib/css-builders.ts +++ b/lib/css-builders.ts @@ -13,6 +13,7 @@ export function images(pack: EmojiDefinition): string { 'height: 23px;' + 'margin-top: -1px;' + 'margin-bottom: -1px;' + + 'vertical-align: bottom;' + '}'; } diff --git a/lib/parse.ts b/lib/parse.ts index 6db5dea..09ced46 100644 --- a/lib/parse.ts +++ b/lib/parse.ts @@ -236,3 +236,17 @@ export async function postSummaries(data: { posts: [{ topic: { title: string } } } return data; } + +export async function notifications( + data: { notifications: [{ bodyShort: string } ] } +) : Promise { + if (options.titles) { + await Promise.all(data.notifications.map(async (n) => { + if (n && n.bodyShort) { + // eslint-disable-next-line no-param-reassign + n.bodyShort = await parse(n.bodyShort); + } + })); + } + return data; +} diff --git a/plugin.json b/plugin.json index 5ecc3ea..62c3dd1 100644 --- a/plugin.json +++ b/plugin.json @@ -34,6 +34,7 @@ { "hook": "filter:topic.get", "method": "parse.topic" }, { "hook": "filter:topics.get", "method": "parse.topics" }, { "hook": "filter:post.getPostSummaryByPids", "method": "parse.postSummaries" }, + { "hook": "filter:user.notifications.getNotifications", "method": "parse.notifications" }, { "hook": "filter:meta.getLinkTags", "method": "addStylesheet" }, { "hook": "filter:config.get", "method": "configGet" } ]