|
@@ -142,6 +142,7 @@ module.exports = function(crowi, app) {
|
|
|
const PageTagRelation = crowi.model('PageTagRelation');
|
|
const PageTagRelation = crowi.model('PageTagRelation');
|
|
|
const UpdatePost = crowi.model('UpdatePost');
|
|
const UpdatePost = crowi.model('UpdatePost');
|
|
|
const GlobalNotificationSetting = crowi.model('GlobalNotificationSetting');
|
|
const GlobalNotificationSetting = crowi.model('GlobalNotificationSetting');
|
|
|
|
|
+ const ShareLink = crowi.model('ShareLink');
|
|
|
|
|
|
|
|
const ApiResponse = require('../util/apiResponse');
|
|
const ApiResponse = require('../util/apiResponse');
|
|
|
const getToday = require('../util/getToday');
|
|
const getToday = require('../util/getToday');
|
|
@@ -439,6 +440,30 @@ module.exports = function(crowi, app) {
|
|
|
return showPageForGrowiBehavior(req, res, next);
|
|
return showPageForGrowiBehavior(req, res, next);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ actions.showSharePage = async function(req, res, next) {
|
|
|
|
|
+ const { linkId } = req.params;
|
|
|
|
|
+
|
|
|
|
|
+ const layoutName = configManager.getConfig('crowi', 'customize:layout');
|
|
|
|
|
+ // TODO Consider the layout for share
|
|
|
|
|
+ const view = `layout-${layoutName}/page`;
|
|
|
|
|
+
|
|
|
|
|
+ const shareLink = await ShareLink.find({ _id: linkId }).populate('Page');
|
|
|
|
|
+ const page = shareLink.relatedPage;
|
|
|
|
|
+
|
|
|
|
|
+ if (page == null) {
|
|
|
|
|
+ // page is not found
|
|
|
|
|
+ return next();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const renderVars = {};
|
|
|
|
|
+
|
|
|
|
|
+ addRendarVarsForPage(renderVars, page);
|
|
|
|
|
+ addRendarVarsForScope(renderVars, page);
|
|
|
|
|
+
|
|
|
|
|
+ await interceptorManager.process('beforeRenderPage', req, res, renderVars);
|
|
|
|
|
+ return res.render(view, renderVars);
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* switch action by behaviorType
|
|
* switch action by behaviorType
|
|
|
*/
|
|
*/
|