feat: show bodyLong in notifications, closes #4767

dont show blockquotes
show post content in flag notification
This commit is contained in:
Barış Soner Uşaklı
2026-02-05 14:08:31 -05:00
parent 149d649a6c
commit 30541a9693
7 changed files with 52 additions and 31 deletions

View File

@@ -97,13 +97,13 @@
"multer": "2.0.2", "multer": "2.0.2",
"nconf": "0.13.0", "nconf": "0.13.0",
"nodebb-plugin-2factor": "7.6.1", "nodebb-plugin-2factor": "7.6.1",
"nodebb-plugin-composer-default": "10.3.5", "nodebb-plugin-composer-default": "10.3.6",
"nodebb-plugin-dbsearch": "6.3.5", "nodebb-plugin-dbsearch": "6.3.5",
"nodebb-plugin-emoji": "6.0.5", "nodebb-plugin-emoji": "6.0.5",
"nodebb-plugin-emoji-android": "4.1.1", "nodebb-plugin-emoji-android": "4.1.1",
"nodebb-plugin-link-preview": "2.2.2", "nodebb-plugin-link-preview": "2.2.2",
"nodebb-plugin-markdown": "13.2.3", "nodebb-plugin-markdown": "13.2.3",
"nodebb-plugin-mentions": "4.8.6", "nodebb-plugin-mentions": "4.8.7",
"nodebb-plugin-spam-be-gone": "2.3.2", "nodebb-plugin-spam-be-gone": "2.3.2",
"nodebb-plugin-web-push": "0.7.6", "nodebb-plugin-web-push": "0.7.6",
"nodebb-rewards-essentials": "1.0.2", "nodebb-rewards-essentials": "1.0.2",

View File

@@ -84,7 +84,7 @@
"composer.hide-preview": "Hide Preview", "composer.hide-preview": "Hide Preview",
"composer.help": "Help", "composer.help": "Help",
"composer.user-said-in": "%1 said in %2:", "composer.user-said-in": "%1 said in %2:",
"composer.user-said": "%1 said:", "composer.user-said": "%1 [said](%2):",
"composer.discard": "Are you sure you wish to discard this post?", "composer.discard": "Are you sure you wish to discard this post?",
"composer.submit-and-lock": "Submit and Lock", "composer.submit-and-lock": "Submit and Lock",
"composer.toggle-dropdown": "Toggle Dropdown", "composer.toggle-dropdown": "Toggle Dropdown",

View File

@@ -36,33 +36,33 @@
"user-posted-in-public-room-dual": "<strong>%1</strong> and <strong>%2</strong> wrote in <strong class=\"text-nowrap\"><i class=\"fa %3\"></i>%4</strong>", "user-posted-in-public-room-dual": "<strong>%1</strong> and <strong>%2</strong> wrote in <strong class=\"text-nowrap\"><i class=\"fa %3\"></i>%4</strong>",
"user-posted-in-public-room-triple": "<strong>%1</strong>, <strong>%2</strong> and <strong>%3</strong> wrote in <strong class=\"text-nowrap\"><i class=\"fa %4\"></i>%5</strong>", "user-posted-in-public-room-triple": "<strong>%1</strong>, <strong>%2</strong> and <strong>%3</strong> wrote in <strong class=\"text-nowrap\"><i class=\"fa %4\"></i>%5</strong>",
"user-posted-in-public-room-multiple": "<strong>%1</strong>, <strong>%2</strong> and %3 others wrote in <strong class=\"text-nowrap\"><i class=\"fa %4\"></i>%5</strong>", "user-posted-in-public-room-multiple": "<strong>%1</strong>, <strong>%2</strong> and %3 others wrote in <strong class=\"text-nowrap\"><i class=\"fa %4\"></i>%5</strong>",
"upvoted-your-post-in": "<strong>%1</strong> has upvoted your post in <strong>%2</strong>.", "upvoted-your-post-in": "<strong>%1</strong> upvoted<br/><strong>%2</strong>",
"upvoted-your-post-in-dual": "<strong>%1</strong> and <strong>%2</strong> have upvoted your post in <strong>%3</strong>.", "upvoted-your-post-in-dual": "<strong>%1</strong> and <strong>%2</strong> upvoted<br/><strong>%3</strong>",
"upvoted-your-post-in-triple": "<strong>%1</strong>, <strong>%2</strong> and <strong>%3</strong> have upvoted your post in <strong>%4</strong>.", "upvoted-your-post-in-triple": "<strong>%1</strong>, <strong>%2</strong> and <strong>%3</strong> upvoted<br/><strong>%4</strong>",
"upvoted-your-post-in-multiple": "<strong>%1</strong>, <strong>%2</strong> and %3 others have upvoted your post in <strong>%4</strong>.", "upvoted-your-post-in-multiple": "<strong>%1</strong>, <strong>%2</strong> and %3 others upvoted<br/><strong>%4</strong>.",
"moved-your-post": "<strong>%1</strong> has moved your post to <strong>%2</strong>", "moved-your-post": "<strong>%1</strong> has moved your post to <strong>%2</strong>",
"moved-your-topic": "<strong>%1</strong> has moved <strong>%2</strong>", "moved-your-topic": "<strong>%1</strong> has moved <strong>%2</strong>",
"user-flagged-post-in": "<strong>%1</strong> flagged a post in <strong>%2</strong>", "user-flagged-post-in": "<strong>%1</strong> flagged a post<br/><strong>%2</strong>",
"user-flagged-post-in-dual": "<strong>%1</strong> and <strong>%2</strong> flagged a post in <strong>%3</strong>", "user-flagged-post-in-dual": "<strong>%1</strong> and <strong>%2</strong> flagged a post<br/><strong>%3</strong>",
"user-flagged-post-in-triple": "<strong>%1</strong>, <strong>%2</strong> and <strong>%3</strong> flagged a post in <strong>%4</strong>", "user-flagged-post-in-triple": "<strong>%1</strong>, <strong>%2</strong> and <strong>%3</strong> flagged a post<br/><strong>%4</strong>",
"user-flagged-post-in-multiple": "<strong>%1</strong>, <strong>%2</strong> and %3 others flagged a post in <strong>%4</strong>", "user-flagged-post-in-multiple": "<strong>%1</strong>, <strong>%2</strong> and %3 others flagged a post<br/><strong>%4</strong>",
"user-flagged-user": "<strong>%1</strong> flagged a user profile (%2)", "user-flagged-user": "<strong>%1</strong> flagged a user profile (%2)",
"user-flagged-user-dual": "<strong>%1</strong> and <strong>%2</strong> flagged a user profile (%3)", "user-flagged-user-dual": "<strong>%1</strong> and <strong>%2</strong> flagged a user profile (%3)",
"user-flagged-user-triple": "<strong>%1</strong>, <strong>%2</strong> and <strong>%3</strong> flagged a user profile (%4)", "user-flagged-user-triple": "<strong>%1</strong>, <strong>%2</strong> and <strong>%3</strong> flagged a user profile (%4)",
"user-flagged-user-multiple": "<strong>%1</strong>, <strong>%2</strong> and %3 others flagged a user profile (%4)", "user-flagged-user-multiple": "<strong>%1</strong>, <strong>%2</strong> and %3 others flagged a user profile (%4)",
"user-posted-to" : "<strong>%1</strong> has posted a reply to: <strong>%2</strong>", "user-posted-to" : "<strong>%1</strong> replied in<br/><strong>%2</strong>",
"user-posted-to-dual" : "<strong>%1</strong> and <strong>%2</strong> have posted replies to: <strong>%3</strong>", "user-posted-to-dual" : "<strong>%1</strong> and <strong>%2</strong> replied in<br/><strong>%3</strong>",
"user-posted-to-triple" : "<strong>%1</strong>, <strong>%2</strong> and <strong>%3</strong> have posted replies to: <strong>%4</strong>", "user-posted-to-triple" : "<strong>%1</strong>, <strong>%2</strong> and <strong>%3</strong> replied in<br/><strong>%4</strong>",
"user-posted-to-multiple" : "<strong>%1</strong>, <strong>%2</strong> and %3 others have posted replies to: <strong>%4</strong>", "user-posted-to-multiple" : "<strong>%1</strong>, <strong>%2</strong> and %3 others replied in<br/><strong>%4</strong>",
"user-posted-topic": "<strong>%1</strong> has posted a new topic: <strong>%2</strong>", "user-posted-topic": "<strong>%1</strong> posted<br/><strong>%2</strong>",
"user-edited-post" : "<strong>%1</strong> has edited a post in <strong>%2</strong>", "user-edited-post" : "<strong>%1</strong> edited a post in<br/><strong>%2</strong>",
"user-posted-topic-with-tag": "<strong>%1</strong> has posted <strong>%2</strong> (tagged %3)", "user-posted-topic-with-tag": "<strong>%1</strong> posted<br/><strong>%2</strong> (tagged %3)",
"user-posted-topic-with-tag-dual": "<strong>%1</strong> has posted <strong>%2</strong> (tagged %3 and %4)", "user-posted-topic-with-tag-dual": "<strong>%1</strong> posted<br/><strong>%2</strong> (tagged %3 and %4)",
"user-posted-topic-with-tag-triple": "<strong>%1</strong> has posted <strong>%2</strong> (tagged %3, %4, and %5)", "user-posted-topic-with-tag-triple": "<strong>%1</strong> posted<br/><strong>%2</strong> (tagged %3, %4, and %5)",
"user-posted-topic-with-tag-multiple": "<strong>%1</strong> has posted <strong>%2</strong> (tagged %3)", "user-posted-topic-with-tag-multiple": "<strong>%1</strong> posted<br/><strong>%2</strong> (tagged %3)",
"user-posted-topic-in-category": "<strong>%1</strong> has posted a new topic in <strong>%2</strong>", "user-posted-topic-in-category": "<strong>%1</strong> posted<br/><strong>%2</strong> (category %3)",
"user-started-following-you": "<strong>%1</strong> started following you.", "user-started-following-you": "<strong>%1</strong> started following you.",
"user-started-following-you-dual": "<strong>%1</strong> and <strong>%2</strong> started following you.", "user-started-following-you-dual": "<strong>%1</strong> and <strong>%2</strong> started following you.",

View File

@@ -145,6 +145,18 @@ blockquote {
} }
} }
.hidden-blockquote {
blockquote {
display: none;
}
}
.hidden-leading-br {
> br:first-child {
display: none;
}
}
// some classes that are used commonly in themes from bs3 // some classes that are used commonly in themes from bs3
.hidden, .hide { .hidden, .hide {
display: none!important; display: none!important;

View File

@@ -237,10 +237,14 @@ module.exports = function (Categories) {
} }
const { displayname } = postData.user; const { displayname } = postData.user;
const categoryName = await Categories.getCategoryField(cid, 'name'); const [categoryName, title] = await Promise.all([
Categories.getCategoryField(cid, 'name'),
topics.getTopicField(postData.topic.tid, 'title'),
]);
const notifBase = 'notifications:user-posted-topic-in-category'; const notifBase = 'notifications:user-posted-topic-in-category';
const bodyShort = translator.compile(notifBase, displayname, categoryName); const bodyShort = translator.compile(notifBase, displayname, title, categoryName);
const notification = await notifications.create({ const notification = await notifications.create({
type: 'new-topic-in-category', type: 'new-topic-in-category',

View File

@@ -934,7 +934,7 @@ Flags.notify = async function (flagObj, uid, notifySelf = false) {
notifObj = await notifications.create({ notifObj = await notifications.create({
type: 'new-post-flag', type: 'new-post-flag',
bodyShort: `[[notifications:user-flagged-post-in, ${displayname}, ${titleEscaped}]]`, bodyShort: `[[notifications:user-flagged-post-in, ${displayname}, ${titleEscaped}]]`,
bodyLong: await plugins.hooks.fire('filter:parse.raw', String(flagObj.description || '')), bodyLong: String(flagObj.target?.content || ''),
pid: flagObj.targetId, pid: flagObj.targetId,
path: `/flags/${flagObj.flagId}`, path: `/flags/${flagObj.flagId}`,
nid: `flag:post:${flagObj.targetId}:${uid}`, nid: `flag:post:${flagObj.targetId}:${uid}`,

View File

@@ -84,20 +84,25 @@ module.exports = function (Posts) {
returnPostData.oldContent = oldContent; returnPostData.oldContent = oldContent;
returnPostData.newContent = data.content; returnPostData.newContent = data.content;
await topics.notifyFollowers(returnPostData, data.uid, {
type: 'post-edit',
bodyShort: translator.compile('notifications:user-edited-post', editor.username, topic.title),
nid: `edit_post:${data.pid}:uid:${data.uid}`,
});
await topics.syncBacklinks(returnPostData); await topics.syncBacklinks(returnPostData);
plugins.hooks.fire('action:post.edit', { post: { ...returnPostData, _activitypub }, data: data, uid: data.uid }); plugins.hooks.fire('action:post.edit', {
post: { ...returnPostData, _activitypub },
data: data,
uid: data.uid,
});
Posts.clearCachedPost(String(postData.pid)); Posts.clearCachedPost(String(postData.pid));
pubsub.publish('post:edit', String(postData.pid)); pubsub.publish('post:edit', String(postData.pid));
await Posts.parsePost(returnPostData); await Posts.parsePost(returnPostData);
await topics.notifyFollowers(returnPostData, data.uid, {
type: 'post-edit',
bodyShort: translator.compile('notifications:user-edited-post', editor.username, topic.title),
nid: `edit_post:${data.pid}:uid:${data.uid}`,
});
return { return {
topic: topic, topic: topic,
editor: editor, editor: editor,