|
|
@@ -9,6 +9,7 @@ class GlobalNotificationService {
|
|
|
this.config = crowi.getConfig();
|
|
|
this.mailer = crowi.getMailer();
|
|
|
this.GlobalNotification = crowi.model('GlobalNotificationSetting');
|
|
|
+ this.User = crowi.model('User');
|
|
|
this.Config = crowi.model('Config');
|
|
|
this.appTitle = this.Config.appTitle(this.config);
|
|
|
}
|
|
|
@@ -68,7 +69,11 @@ class GlobalNotificationService {
|
|
|
mail: {
|
|
|
subject: `#pageEdit - ${page.creator.username} edited ${page.path}`,
|
|
|
template: `../../locales/${lang}/notifications/pageEdit.txt`,
|
|
|
- vars: {}
|
|
|
+ vars: {
|
|
|
+ appTitle: this.appTitle,
|
|
|
+ path: page.path,
|
|
|
+ username: page.creator.username,
|
|
|
+ }
|
|
|
},
|
|
|
slack: {},
|
|
|
};
|
|
|
@@ -88,7 +93,11 @@ class GlobalNotificationService {
|
|
|
mail: {
|
|
|
subject: `#pageDelete - ${page.creator.username} deleted ${page.path}`, //FIXME
|
|
|
template: `../../locales/${lang}/notifications/pageDelete.txt`,
|
|
|
- vars: {}
|
|
|
+ vars: {
|
|
|
+ appTitle: this.appTitle,
|
|
|
+ path: page.path,
|
|
|
+ username: page.creator.username,
|
|
|
+ }
|
|
|
},
|
|
|
slack: {},
|
|
|
};
|
|
|
@@ -101,14 +110,19 @@ class GlobalNotificationService {
|
|
|
* @memberof GlobalNotification
|
|
|
* @param {obejct} page
|
|
|
*/
|
|
|
- async notifyPageMove(page, user) {
|
|
|
+ async notifyPageMove(page, oldPagePath, user) {
|
|
|
const notifications = await this.GlobalNotification.Parent.findSettingByPathAndEvent(page.path, 'pageMove');
|
|
|
const lang = 'en-US'; //FIXME
|
|
|
const option = {
|
|
|
mail: {
|
|
|
subject: `#pageMove - ${user.username} moved ${page.path} to ${page.path}`, //FIXME
|
|
|
template: `../../locales/${lang}/notifications/pageMove.txt`,
|
|
|
- vars: {}
|
|
|
+ vars: {
|
|
|
+ appTitle: this.appTitle,
|
|
|
+ oldPath: oldPagePath,
|
|
|
+ newPath: page.path,
|
|
|
+ username: user.username,
|
|
|
+ }
|
|
|
},
|
|
|
slack: {},
|
|
|
};
|
|
|
@@ -128,7 +142,11 @@ class GlobalNotificationService {
|
|
|
mail: {
|
|
|
subject: `#pageLike - ${user.username} liked ${page.path}`,
|
|
|
template: `../../locales/${lang}/notifications/pageLike.txt`,
|
|
|
- vars: {}
|
|
|
+ vars: {
|
|
|
+ appTitle: this.appTitle,
|
|
|
+ path: page.path,
|
|
|
+ username: page.creator.username,
|
|
|
+ }
|
|
|
},
|
|
|
slack: {},
|
|
|
};
|
|
|
@@ -145,11 +163,17 @@ class GlobalNotificationService {
|
|
|
async notifyComment(comment, path) {
|
|
|
const notifications = await this.GlobalNotification.Parent.findSettingByPathAndEvent(path, 'comment');
|
|
|
const lang = 'en-US'; //FIXME
|
|
|
+ const user = await this.User.findOne({_id: comment.creator});
|
|
|
const option = {
|
|
|
mail: {
|
|
|
- subject: `#comment - ${comment.creator.username} commented on ${path}`,
|
|
|
+ subject: `#comment - ${user.username} commented on ${path}`,
|
|
|
template: `../../locales/${lang}/notifications/comment.txt`,
|
|
|
- vars: {}
|
|
|
+ vars: {
|
|
|
+ appTitle: this.appTitle,
|
|
|
+ path: path,
|
|
|
+ username: user.username,
|
|
|
+ comment: comment.comment,
|
|
|
+ }
|
|
|
},
|
|
|
slack: {},
|
|
|
};
|