|
|
@@ -1,4 +1,5 @@
|
|
|
const debug = require('debug')('growi:service:GlobalNotification');
|
|
|
+const path = require('path');
|
|
|
const Notification = require('../models/GlobalNotificationSetting');
|
|
|
const mailer = require('../util/mailer');
|
|
|
|
|
|
@@ -38,10 +39,11 @@ class GlobalNotification {
|
|
|
*/
|
|
|
notifyPageCreate(page) {
|
|
|
const notifications = Notification.findSettingByPathAndEvent(page.path, 'pageCreate');
|
|
|
+ const lang = 'en-US'; //FIXME
|
|
|
const option = {
|
|
|
mail: {
|
|
|
subject: `#pageCreate - ${page.creator.username} created ${page.path}`,
|
|
|
- template: 'notification/pageCreate.txt',
|
|
|
+ template: path.join(this.crowi.localeDir, lang, 'notifications/pageCreate.txt'),
|
|
|
vars: {}
|
|
|
},
|
|
|
slack: {},
|
|
|
@@ -57,10 +59,11 @@ class GlobalNotification {
|
|
|
*/
|
|
|
notifyPageEdit(page) {
|
|
|
const notifications = Notification.findSettingByPathAndEvent(page.path, 'pageEdit');
|
|
|
+ const lang = 'en-US'; //FIXME
|
|
|
const option = {
|
|
|
mail: {
|
|
|
subject: `#pageEdit - ${page.creator.username} edited ${page.path}`,
|
|
|
- template: 'notification/pageEdit.txt',
|
|
|
+ template: path.join(this.crowi.localeDir, lang, 'notifications/pageEdit.txt'),
|
|
|
vars: {}
|
|
|
},
|
|
|
slack: {},
|
|
|
@@ -76,10 +79,11 @@ class GlobalNotification {
|
|
|
*/
|
|
|
notifyPageDelete(page) {
|
|
|
const notifications = Notification.findSettingByPathAndEvent(page.path, 'pageDelete');
|
|
|
+ const lang = 'en-US'; //FIXME
|
|
|
const option = {
|
|
|
mail: {
|
|
|
subject: `#pageDelete - ${page.creator.username} deleted ${page.path}`, //FIXME
|
|
|
- template: 'notification/pageDelete.txt',
|
|
|
+ template: path.join(this.crowi.localeDir, lang, 'notifications/pageDelete.txt'),
|
|
|
vars: {}
|
|
|
},
|
|
|
slack: {},
|
|
|
@@ -95,10 +99,11 @@ class GlobalNotification {
|
|
|
*/
|
|
|
notifyPageMove(page) {
|
|
|
const notifications = Notification.findSettingByPathAndEvent(page.path, 'pageMove');
|
|
|
+ const lang = 'en-US'; //FIXME
|
|
|
const option = {
|
|
|
mail: {
|
|
|
subject: `#pageMove - ${page.creator.username} moved ${page.path} to ${page.path}`, //FIXME
|
|
|
- template: 'notification/pageMove.txt',
|
|
|
+ template: path.join(this.crowi.localeDir, lang, 'notifications/pageMove.txt'),
|
|
|
vars: {}
|
|
|
},
|
|
|
slack: {},
|
|
|
@@ -114,10 +119,11 @@ class GlobalNotification {
|
|
|
*/
|
|
|
notifyPageLike(page) {
|
|
|
const notifications = Notification.findSettingByPathAndEvent(page.path, 'pageLike');
|
|
|
+ const lang = 'en-US'; //FIXME
|
|
|
const option = {
|
|
|
mail: {
|
|
|
subject: `#pageLike - ${page.creator.username} liked ${page.path}`,
|
|
|
- template: 'notification/pageLike.txt',
|
|
|
+ template: path.join(this.crowi.localeDir, lang, 'notifications/pageLike.txt'),
|
|
|
vars: {}
|
|
|
},
|
|
|
slack: {},
|
|
|
@@ -134,10 +140,11 @@ class GlobalNotification {
|
|
|
*/
|
|
|
notifyComment(comment, path) {
|
|
|
const notifications = Notification.findSettingByPathAndEvent(path, 'comment');
|
|
|
+ const lang = 'en-US'; //FIXME
|
|
|
const option = {
|
|
|
mail: {
|
|
|
subject: `#comment - ${comment.creator.username} commented on ${path}`,
|
|
|
- template: 'notification/comment.txt',
|
|
|
+ template: path.join(this.crowi.localeDir, lang, 'notifications/comment.txt'),
|
|
|
vars: {}
|
|
|
},
|
|
|
slack: {},
|