|
|
@@ -10,6 +10,7 @@ module.exports = function(crowi, app) {
|
|
|
, Bookmark = crowi.model('Bookmark')
|
|
|
, UserGroupRelation = crowi.model('UserGroupRelation')
|
|
|
, PageGroupRelation = crowi.model('PageGroupRelation')
|
|
|
+ , UpdatePost = crowi.model('UpdatePost')
|
|
|
, ApiResponse = require('../util/apiResponse')
|
|
|
, interceptorManager = crowi.getInterceptorManager()
|
|
|
, pagePathUtil = require('../util/pagePathUtil')
|
|
|
@@ -289,6 +290,20 @@ module.exports = function(crowi, app) {
|
|
|
renderVars.pageRelatedGroup = pageGroupRelation.relatedGroup;
|
|
|
}
|
|
|
})
|
|
|
+ .then(() => {
|
|
|
+ if (page.extended.slack) {
|
|
|
+ renderVars.slack = page.extended.slack;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return UpdatePost.findSettingsByPath(page.path)
|
|
|
+ .then(function(data) {
|
|
|
+ renderVars.slack = data.map(e => e.channel).join(', ');
|
|
|
+ }).catch(function(err) {
|
|
|
+ debug('Error occured in getting slack channels', err);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
.then(function() {
|
|
|
var userPage = isUserPage(page.path);
|
|
|
var userData = null;
|
|
|
@@ -475,6 +490,7 @@ module.exports = function(crowi, app) {
|
|
|
page: pageData,
|
|
|
revision: pageData.revision || {},
|
|
|
author: pageData.revision.author || false,
|
|
|
+ slack: '',
|
|
|
};
|
|
|
var userPage = isUserPage(pageData.path);
|
|
|
var userData = null;
|
|
|
@@ -491,6 +507,20 @@ module.exports = function(crowi, app) {
|
|
|
renderVars.pageRelatedGroup = pageGroupRelation.relatedGroup;
|
|
|
}
|
|
|
})
|
|
|
+ .then(() => {
|
|
|
+ if (pageData.extended.slack) {
|
|
|
+ renderVars.slack = pageData.extended.slack;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return UpdatePost.findSettingsByPath(pageData.path)
|
|
|
+ .then(function(data) {
|
|
|
+ renderVars.slack = data.map(e => e.channel).join(', ');
|
|
|
+ }).catch(function(err) {
|
|
|
+ debug('Error occured in getting slack channels', err);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
.then(function() {
|
|
|
if (userPage) {
|
|
|
return User.findUserByUsername(User.getUsernameByPath(pageData.path))
|