feat: send topic title into user-posted-topic-with-tag notification type, unbold tags in copy

This commit is contained in:
Julian Lam
2024-06-25 13:04:34 -04:00
parent b1f11f3b69
commit 1611b17bd7
2 changed files with 9 additions and 8 deletions

View File

@@ -57,10 +57,10 @@
"user-posted-topic": "<strong>%1</strong> has posted a new topic: <strong>%2</strong>", "user-posted-topic": "<strong>%1</strong> has posted a new topic: <strong>%2</strong>",
"user-edited-post" : "<strong>%1</strong> has edited a post in <strong>%2</strong>", "user-edited-post" : "<strong>%1</strong> has edited a post in <strong>%2</strong>",
"user-posted-topic-with-tag": "<strong>%1</strong> has posted a new topic with tag <strong>%2</strong>", "user-posted-topic-with-tag": "<strong>%1</strong> has posted <strong>%2</strong> (tagged %3)",
"user-posted-topic-with-tag-dual": "<strong>%1</strong> has posted a new topic with tags <strong>%2</strong> and <strong>%3</strong>", "user-posted-topic-with-tag-dual": "<strong>%1</strong> has posted <strong>%2</strong> (tagged %3 and %4)",
"user-posted-topic-with-tag-triple": "<strong>%1</strong> has posted a new topic with tags <strong>%2</strong>, <strong>%3</strong> and <strong>%4</strong>", "user-posted-topic-with-tag-triple": "<strong>%1</strong> has posted <strong>%2</strong> (tagged %3, %4, and %5)",
"user-posted-topic-with-tag-multiple": "<strong>%1</strong> has posted a new topic with tags <strong>%2</strong>", "user-posted-topic-with-tag-multiple": "<strong>%1</strong> has posted <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> has posted a new topic in <strong>%2</strong>",

View File

@@ -588,6 +588,7 @@ module.exports = function (Topics) {
}; };
Topics.notifyTagFollowers = async function (postData, exceptUid) { Topics.notifyTagFollowers = async function (postData, exceptUid) {
console.log();
let { tags } = postData.topic; let { tags } = postData.topic;
if (!tags.length) { if (!tags.length) {
return; return;
@@ -609,13 +610,13 @@ module.exports = function (Topics) {
const { displayname } = postData.user; const { displayname } = postData.user;
const notifBase = 'notifications:user-posted-topic-with-tag'; const notifBase = 'notifications:user-posted-topic-with-tag';
let bodyShort = translator.compile(notifBase, displayname, tags[0]); let bodyShort = translator.compile(notifBase, displayname, postData.topic.title, tags[0]);
if (tags.length === 2) { if (tags.length === 2) {
bodyShort = translator.compile(`${notifBase}-dual`, displayname, tags[0], tags[1]); bodyShort = translator.compile(`${notifBase}-dual`, displayname, postData.topic.title, tags[0], tags[1]);
} else if (tags.length === 3) { } else if (tags.length === 3) {
bodyShort = translator.compile(`${notifBase}-triple`, displayname, tags[0], tags[1], tags[2]); bodyShort = translator.compile(`${notifBase}-triple`, displayname, postData.topic.title, tags[0], tags[1], tags[2]);
} else if (tags.length > 3) { } else if (tags.length > 3) {
bodyShort = translator.compile(`${notifBase}-multiple`, displayname, tags.join(', ')); bodyShort = translator.compile(`${notifBase}-multiple`, displayname, postData.topic.title, tags.join(', '));
} }
const notification = await notifications.create({ const notification = await notifications.create({