Explorar o código

WIP: replace slack libs

* adjust to the 'attachments' argument for Web API
Yuki Takei %!s(int64=8) %!d(string=hai) anos
pai
achega
9ae75a9463
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      lib/util/slack.js

+ 4 - 0
lib/util/slack.js

@@ -21,6 +21,10 @@ module.exports = function(crowi) {
 
   const postWithWebApi = function(messageObj, callback) {
     const client = new Slack(config.notification['slack:token']);
+    // stringify attachments
+    if (messageObj.attachments != null) {
+      messageObj.attachments = JSON.stringify(messageObj.attachments);
+    }
     client.api('chat.postMessage', messageObj, callback);
   }