itizawa 5 лет назад
Родитель
Сommit
9f09d9e1b5

+ 1 - 1
src/server/routes/comment.js

@@ -271,7 +271,7 @@ module.exports = function(crowi, app) {
       const { slackChannels } = slackNotificationForm;
 
       try {
-        const results = await userNotificationService.fire(page, req.user, slackChannels, 'comment', '', createdComment);
+        const results = await userNotificationService.fire(page, req.user, slackChannels, 'comment', {}, createdComment);
         results.forEach((result) => {
           if (result.status === 'rejected') {
             logger.error('Create user notification failed', result.reason);

+ 1 - 1
src/server/routes/page.js

@@ -868,7 +868,7 @@ module.exports = function(crowi, app) {
     // user notification
     if (isSlackEnabled) {
       try {
-        const results = await userNotificationService.fire(page, req.user, slackChannels, 'update', previousRevision);
+        const results = await userNotificationService.fire(page, req.user, slackChannels, 'update', { previousRevision });
         results.forEach((result) => {
           if (result.status === 'rejected') {
             logger.error('Create user notification failed', result.reason);

+ 4 - 1
src/server/service/user-notification/index.js

@@ -23,9 +23,12 @@ class UserNotificationService {
    * @param {string} previousRevision
    * @param {Comment} comment
    */
-  async fire(page, user, slackChannelsStr, mode, previousRevision = '', comment = {}) {
+  async fire(page, user, slackChannelsStr, mode, option, comment = {}) {
     const { slackNotificationService, slack } = this.crowi;
 
+    const opt = option || {};
+    const previousRevision = opt.previousRevision || '';
+
     await page.updateSlackChannels(slackChannelsStr);
 
     if (!slackNotificationService.hasSlackConfig()) {