Răsfoiți Sursa

refs #914: Expect to use a RevisionURL (which use the object ID of the page) in slack message that is notified when page or comment is updated
- Fixed an error that occurred when posting comments and sharing to slack.
- The urljoin method requires a string value, but the "page" field in the Comment model is an ObjectId value.

Tatsuya Ise 7 ani în urmă
părinte
comite
4ac13d393f
1 a modificat fișierele cu 2 adăugiri și 1 ștergeri
  1. 2 1
      src/server/util/slack.js

+ 2 - 1
src/server/util/slack.js

@@ -160,7 +160,7 @@ module.exports = function(crowi) {
     const message = {
       channel: `#${channel}`,
       username: Config.appTitle(config),
-      text: getSlackMessageTextForComment(path, comment.page.id, user),
+      text: getSlackMessageTextForComment(path, String(comment.page), user),
       attachments: [attachment],
     };
 
@@ -184,6 +184,7 @@ module.exports = function(crowi) {
 
   const getSlackMessageTextForComment = function(path, pageId, user) {
     const url = crowi.configManager.getSiteUrl();
+    console.log('pageId: ', pageId);
     const pageUrl = `<${urljoin(url, pageId)}|${path}>`;
     const text = `:speech_balloon: ${user.username} commented on ${pageUrl}`;