utsushiiro 7 лет назад
Родитель
Сommit
0c38b36d25
1 измененных файлов с 5 добавлено и 8 удалено
  1. 5 8
      src/server/util/slack.js

+ 5 - 8
src/server/util/slack.js

@@ -45,10 +45,7 @@ module.exports = function(crowi) {
   };
   };
 
 
   const convertMarkdownToMarkdown = function(body) {
   const convertMarkdownToMarkdown = function(body) {
-    var url = '';
-    if (config.crowi && config.crowi['app:siteUrl:fixed']) {
-      url = config.crowi['app:siteUrl:fixed'];
-    }
+    const url = crowi.configManager.getSiteUrl();
 
 
     body = body
     body = body
       .replace(/\n\*\s(.+)/g, '\n• $1')
       .replace(/\n\*\s(.+)/g, '\n• $1')
@@ -113,7 +110,7 @@ module.exports = function(crowi) {
   };
   };
 
 
   const prepareSlackMessageForPage = function(page, user, channel, updateType, previousRevision) {
   const prepareSlackMessageForPage = function(page, user, channel, updateType, previousRevision) {
-    const url = config.crowi['app:siteUrl:fixed'] || '';
+    const url = crowi.configManager.getSiteUrl();
     let body = page.revision.body;
     let body = page.revision.body;
 
 
     if (updateType == 'create') {
     if (updateType == 'create') {
@@ -148,7 +145,7 @@ module.exports = function(crowi) {
   };
   };
 
 
   const prepareSlackMessageForComment = function(comment, user, channel, path) {
   const prepareSlackMessageForComment = function(comment, user, channel, path) {
-    const url = config.crowi['app:siteUrl:fixed'] || '';
+    const url = crowi.configManager.getSiteUrl();
     const body = prepareAttachmentTextForComment(comment);
     const body = prepareAttachmentTextForComment(comment);
 
 
     const attachment = {
     const attachment = {
@@ -175,7 +172,7 @@ module.exports = function(crowi) {
 
 
   const getSlackMessageTextForPage = function(path, user, updateType) {
   const getSlackMessageTextForPage = function(path, user, updateType) {
     let text;
     let text;
-    const url = config.crowi['app:siteUrl:fixed'] || '';
+    const url = crowi.configManager.getSiteUrl();
 
 
     const pageUrl = `<${url}${path}|${path}>`;
     const pageUrl = `<${url}${path}|${path}>`;
     if (updateType == 'create') {
     if (updateType == 'create') {
@@ -189,7 +186,7 @@ module.exports = function(crowi) {
   };
   };
 
 
   const getSlackMessageTextForComment = function(path, user) {
   const getSlackMessageTextForComment = function(path, user) {
-    const url = config.crowi['app:siteUrl:fixed'] || '';
+    const url = crowi.configManager.getSiteUrl();
     const pageUrl = `<${url}${path}|${path}>`;
     const pageUrl = `<${url}${path}|${path}>`;
     const text = `:speech_balloon: ${user.username} commented on ${pageUrl}`;
     const text = `:speech_balloon: ${user.username} commented on ${pageUrl}`;