diff --git a/core/server/services/notifications/index.js b/core/server/services/notifications/index.js index b34e07d7cf..4c1ba42a5c 100644 --- a/core/server/services/notifications/index.js +++ b/core/server/services/notifications/index.js @@ -1,12 +1,10 @@ const settingsCache = require('../../../shared/settings-cache'); -const i18n = require('../../../shared/i18n'); const ghostVersion = require('@tryghost/version'); const Notifications = require('./notifications'); const models = require('../../models'); module.exports.notifications = new Notifications({ settingsCache, - i18n, ghostVersion, SettingsModel: models.Settings }); diff --git a/core/server/services/notifications/notifications.js b/core/server/services/notifications/notifications.js index e614827dfc..5ed9b32772 100644 --- a/core/server/services/notifications/notifications.js +++ b/core/server/services/notifications/notifications.js @@ -3,21 +3,25 @@ const semver = require('semver'); const Promise = require('bluebird'); const _ = require('lodash'); const errors = require('@tryghost/errors'); +const tpl = require('@tryghost/tpl'); const ObjectId = require('bson-objectid'); +const messages = { + noPermissionToDismissNotif: 'You do not have permission to dismiss this notification.', + notificationDoesNotExist: 'Notification does not exist.' +}; + class Notifications { /** * * @param {Object} options * @param {Object} options.settingsCache - settings cache instance - * @param {Object} options.i18n - i18n instance * @param {Object} options.ghostVersion * @param {String} options.ghostVersion.full - Ghost instance version in "full" format - major.minor.patch * @param {Object} options.SettingsModel - Ghost's Setting model instance */ - constructor({settingsCache, i18n, ghostVersion, SettingsModel}) { + constructor({settingsCache, ghostVersion, SettingsModel}) { this.settingsCache = settingsCache; - this.i18n = i18n; this.ghostVersion = ghostVersion; this.SettingsModel = SettingsModel; } @@ -195,13 +199,13 @@ class Notifications { if (notificationToMarkAsSeenIndex > -1 && !notificationToMarkAsSeen.dismissible) { return Promise.reject(new errors.NoPermissionError({ - message: this.i18n.t('errors.api.notifications.noPermissionToDismissNotif') + message: tpl(messages.noPermissionToDismissNotif) })); } if (notificationToMarkAsSeenIndex < 0) { return Promise.reject(new errors.NotFoundError({ - message: this.i18n.t('errors.api.notifications.notificationDoesNotExist') + message: tpl(messages.notificationDoesNotExist) })); }