Просмотр исходного кода

fix: Diff of revision contents doesn't appeared when notifing with slack

Yuki Takei 7 лет назад
Родитель
Сommit
e58045fb7a
2 измененных файлов с 2 добавлено и 3 удалено
  1. 1 0
      CHANGES.md
  2. 1 3
      src/server/routes/page.js

+ 1 - 0
CHANGES.md

@@ -5,6 +5,7 @@ CHANGES
 
 
 * Fix: "Anyone with the link" ACL doesn't work correctly
 * Fix: "Anyone with the link" ACL doesn't work correctly
     * Introduced 3.3.0
     * Introduced 3.3.0
+* Fix: Diff of revision contents doesn't appeared when notifing with slack
 * Fix: NPE occured on /admin/security when Crowi Classic Auth Mechanism is set
 * Fix: NPE occured on /admin/security when Crowi Classic Auth Mechanism is set
 * I18n: Cheatsheet for editor
 * I18n: Cheatsheet for editor
 * I18n: Some admin pages
 * I18n: Some admin pages

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

@@ -621,9 +621,9 @@ module.exports = function(crowi, app) {
       options.grantUserGroupId = grantUserGroupId;
       options.grantUserGroupId = grantUserGroupId;
     }
     }
 
 
-    try {
       const Revision = crowi.model('Revision');
       const Revision = crowi.model('Revision');
       const previousRevision = await Revision.findById(revisionId);
       const previousRevision = await Revision.findById(revisionId);
+    try {
       page = await Page.updatePage(page, pageBody, previousRevision.body, req.user, options);
       page = await Page.updatePage(page, pageBody, previousRevision.body, req.user, options);
     }
     }
     catch (err) {
     catch (err) {
@@ -650,8 +650,6 @@ module.exports = function(crowi, app) {
 
 
     // user notification
     // user notification
     if (isSlackEnabled && slackChannels != null) {
     if (isSlackEnabled && slackChannels != null) {
-      const Revision = crowi.model('Revision');
-      const previousRevision = await Revision.findById(page.revision);
       await notifyToSlackByUser(page, req.user, slackChannels, 'update', previousRevision);
       await notifyToSlackByUser(page, req.user, slackChannels, 'update', previousRevision);
     }
     }
   };
   };