Quellcode durchsuchen

deleted debug lines and channels cannot be empty

sou vor 7 Jahren
Ursprung
Commit
65d21bc667
2 geänderte Dateien mit 6 neuen und 17 gelöschten Zeilen
  1. 6 4
      lib/routes/comment.js
  2. 0 13
      lib/routes/page.js

+ 6 - 4
lib/routes/comment.js

@@ -86,11 +86,13 @@ module.exports = function(crowi, app) {
         const path = page.path;
         const channels = slackNotificationForm.slackChannels;
 
-        page.updateSlackChannel(channels).then(function() {}).catch(function() {});
+        if (channels) {
+          page.updateSlackChannel(channels).then(function() {}).catch(function() {});
 
-        channels.split(',').map(function(chan) {
-          crowi.slack.postComment(createdComment, user, chan, path);
-        });
+          channels.split(',').map(function(chan) {
+            crowi.slack.postComment(createdComment, user, chan, path);
+          });
+        }
       }
       catch (err) {
         logger.error('error occured in sending slack notification: ', err);

+ 0 - 13
lib/routes/page.js

@@ -386,19 +386,6 @@ module.exports = function(crowi, app) {
     }
   };
 
-  // const getSlackChannels = page => {
-  //   if (page.extended.slack) {
-  //     return page.extended.slack;
-  //   }
-  //   else {
-  //     return UpdatePost.findSettingsByPath(page.path)
-  //       .then((data) => {
-  //         const channels = data.map(e => e.channel).join(', ');
-  //         return channels;
-  //       });
-  //   }
-  // };
-
   const replacePlaceholders = (template, req) => {
     const definitions = {
       pagepath: getPathFromRequest(req),