Node.js based forum software built for the modern web
feat: translate bodyShort
Barış Soner Uşaklıed15cbb06a53
diff --git a/src/user/notifications.js b/src/user/notifications.jsindex d0efa369a1..04a0fb5ea6 100644--- a/src/user/notifications.js+++ b/src/user/notifications.js@@ -9,6 +9,8 @@ const meta = require('../meta');const notifications = require('../notifications');const privileges = require('../privileges');const plugins = require('../plugins');+const translator = require('../translator');+const user = require('./index');const utils = require('../utils');const UserNotifications = module.exports;@@ -99,9 +101,10 @@ UserNotifications.getNotifications = async function (nids, uid) {return [];}- const [notifObjs, hasRead] = await Promise.all([+ const [notifObjs, hasRead, userSettings] = await Promise.all([notifications.getMultiple(nids),db.isSortedSetMembers(`uid:${uid}:notifications:read`, nids),+ user.getSettings(uid),]);const deletedNids = [];@@ -119,6 +122,12 @@ UserNotifications.getNotifications = async function (nids, uid) {await deleteUserNids(deletedNids, uid);notificationData = await notifications.merge(notificationData);+ await Promise.all(notificationData.map(async (n) => {+ if (n && n.bodyShort) {+ n.bodyShort = await translator.translate(n.bodyShort, userSettings.userLang);+ }+ }));+const result = await plugins.hooks.fire('filter:user.notifications.getNotifications', {uid: uid,notifications: notificationData,