itizawa 5 лет назад
Родитель
Сommit
a4264ec2f7

+ 1 - 1
src/client/js/app.jsx

@@ -101,7 +101,7 @@ if (pageContainer.state.path != null) {
   Object.assign(componentMappings, {
   Object.assign(componentMappings, {
     // eslint-disable-next-line quote-props
     // eslint-disable-next-line quote-props
     'page': <Page />,
     'page': <Page />,
-    'revision-path': <RevisionPath behaviorType={appContainer.config.behaviorType} pageId={pageContainer.state.pageId} pagePath={pageContainer.state.path} />,
+    'revision-path': <RevisionPath pageId={pageContainer.state.pageId} pagePath={pageContainer.state.path} />,
     'tag-label': <TagLabels />,
     'tag-label': <TagLabels />,
     'grw-subnav': <GrowiSubNavigation />,
     'grw-subnav': <GrowiSubNavigation />,
     'grw-subnav-for-user-page': <GrowiSubNavigationForUserPage />,
     'grw-subnav-for-user-page': <GrowiSubNavigationForUserPage />,

+ 5 - 5
src/client/js/components/Admin/Customize/CustomizeFunctionSetting.jsx

@@ -15,7 +15,7 @@ import AdminCustomizeContainer from '../../../services/AdminCustomizeContainer';
 import AdminUpdateButtonRow from '../Common/AdminUpdateButtonRow';
 import AdminUpdateButtonRow from '../Common/AdminUpdateButtonRow';
 import CustomizeFunctionOption from './CustomizeFunctionOption';
 import CustomizeFunctionOption from './CustomizeFunctionOption';
 
 
-class CustomizeBehaviorSetting extends React.Component {
+class CustomizeFunctionSetting extends React.Component {
 
 
   constructor(props) {
   constructor(props) {
     super(props);
     super(props);
@@ -173,14 +173,14 @@ class CustomizeBehaviorSetting extends React.Component {
 
 
 }
 }
 
 
-const CustomizeBehaviorSettingWrapper = (props) => {
-  return createSubscribedElement(CustomizeBehaviorSetting, props, [AppContainer, AdminCustomizeContainer]);
+const CustomizeFunctionSettingWrapper = (props) => {
+  return createSubscribedElement(CustomizeFunctionSetting, props, [AppContainer, AdminCustomizeContainer]);
 };
 };
 
 
-CustomizeBehaviorSetting.propTypes = {
+CustomizeFunctionSetting.propTypes = {
   t: PropTypes.func.isRequired, // i18next
   t: PropTypes.func.isRequired, // i18next
   appContainer: PropTypes.instanceOf(AppContainer).isRequired,
   appContainer: PropTypes.instanceOf(AppContainer).isRequired,
   adminCustomizeContainer: PropTypes.instanceOf(AdminCustomizeContainer).isRequired,
   adminCustomizeContainer: PropTypes.instanceOf(AdminCustomizeContainer).isRequired,
 };
 };
 
 
-export default withTranslation()(CustomizeBehaviorSettingWrapper);
+export default withTranslation()(CustomizeFunctionSettingWrapper);

+ 1 - 1
src/client/js/components/Navbar/GrowiSubNavigationForUserPage.jsx

@@ -33,7 +33,7 @@ const GrowiSubNavigationForUserPage = (props) => {
   return (
   return (
     <div className={`px-3 ${additionalClassNames.join(' ')}`}>
     <div className={`px-3 ${additionalClassNames.join(' ')}`}>
       <h4 className="grw-user-page-path">
       <h4 className="grw-user-page-path">
-        <RevisionPath behaviorType={appContainer.config.behaviorType} pageId={pageId} pagePath={pageContainer.state.path} />
+        <RevisionPath pageId={pageId} pagePath={pageContainer.state.path} />
       </h4>
       </h4>
 
 
       <div className="d-flex align-items-center justify-content-between">
       <div className="d-flex align-items-center justify-content-between">

+ 0 - 3
src/server/models/config.js

@@ -22,7 +22,6 @@ module.exports = function(crowi) {
     // overwrite
     // overwrite
     config['app:installed'] = true;
     config['app:installed'] = true;
     config['app:fileUpload'] = true;
     config['app:fileUpload'] = true;
-    config['customize:behavior'] = 'growi';
     config['customize:layout'] = 'growi';
     config['customize:layout'] = 'growi';
     config['customize:isSavedStatesOfTabChanges'] = false;
     config['customize:isSavedStatesOfTabChanges'] = false;
 
 
@@ -108,7 +107,6 @@ module.exports = function(crowi) {
       'customize:highlightJsStyle' : 'github',
       'customize:highlightJsStyle' : 'github',
       'customize:highlightJsStyleBorder' : false,
       'customize:highlightJsStyleBorder' : false,
       'customize:theme' : 'default',
       'customize:theme' : 'default',
-      'customize:behavior' : 'crowi',
       'customize:layout' : 'crowi',
       'customize:layout' : 'crowi',
       'customize:isEnabledTimeline' : true,
       'customize:isEnabledTimeline' : true,
       'customize:isSavedStatesOfTabChanges' : true,
       'customize:isSavedStatesOfTabChanges' : true,
@@ -190,7 +188,6 @@ module.exports = function(crowi) {
         file: crowi.fileUploadService.getFileUploadEnabled(),
         file: crowi.fileUploadService.getFileUploadEnabled(),
       },
       },
       registrationWhiteList: crowi.configManager.getConfig('crowi', 'security:registrationWhiteList'),
       registrationWhiteList: crowi.configManager.getConfig('crowi', 'security:registrationWhiteList'),
-      behaviorType: crowi.configManager.getConfig('crowi', 'customize:behavior'),
       layoutType: crowi.configManager.getConfig('crowi', 'customize:layout'),
       layoutType: crowi.configManager.getConfig('crowi', 'customize:layout'),
       themeType: crowi.configManager.getConfig('crowi', 'customize:theme'),
       themeType: crowi.configManager.getConfig('crowi', 'customize:theme'),
       isEnabledLinebreaks: crowi.configManager.getConfig('markdown', 'markdown:isEnabledLinebreaks'),
       isEnabledLinebreaks: crowi.configManager.getConfig('markdown', 'markdown:isEnabledLinebreaks'),

+ 0 - 1
src/server/routes/apiv3/customize-setting.js

@@ -152,7 +152,6 @@ module.exports = (crowi) => {
     const customizeParams = {
     const customizeParams = {
       layoutType: await crowi.configManager.getConfig('crowi', 'customize:layout'),
       layoutType: await crowi.configManager.getConfig('crowi', 'customize:layout'),
       themeType: await crowi.configManager.getConfig('crowi', 'customize:theme'),
       themeType: await crowi.configManager.getConfig('crowi', 'customize:theme'),
-      behaviorType: await crowi.configManager.getConfig('crowi', 'customize:behavior'),
       isEnabledTimeline: await crowi.configManager.getConfig('crowi', 'customize:isEnabledTimeline'),
       isEnabledTimeline: await crowi.configManager.getConfig('crowi', 'customize:isEnabledTimeline'),
       isSavedStatesOfTabChanges: await crowi.configManager.getConfig('crowi', 'customize:isSavedStatesOfTabChanges'),
       isSavedStatesOfTabChanges: await crowi.configManager.getConfig('crowi', 'customize:isSavedStatesOfTabChanges'),
       isEnabledAttachTitleHeader: await crowi.configManager.getConfig('crowi', 'customize:isEnabledAttachTitleHeader'),
       isEnabledAttachTitleHeader: await crowi.configManager.getConfig('crowi', 'customize:isEnabledAttachTitleHeader'),

+ 17 - 95
src/server/routes/page.js

@@ -146,16 +146,12 @@ module.exports = function(crowi, app) {
   const ApiResponse = require('../util/apiResponse');
   const ApiResponse = require('../util/apiResponse');
   const getToday = require('../util/getToday');
   const getToday = require('../util/getToday');
 
 
-  const { configManager, slackNotificationService } = crowi;
+  const { slackNotificationService } = crowi;
   const interceptorManager = crowi.getInterceptorManager();
   const interceptorManager = crowi.getInterceptorManager();
   const globalNotificationService = crowi.getGlobalNotificationService();
   const globalNotificationService = crowi.getGlobalNotificationService();
 
 
   const actions = {};
   const actions = {};
 
 
-  const PORTAL_STATUS_NOT_EXISTS = 0;
-  const PORTAL_STATUS_EXISTS = 1;
-  const PORTAL_STATUS_FORBIDDEN = 2;
-
   // register page events
   // register page events
 
 
   const pageEvent = crowi.event('page');
   const pageEvent = crowi.event('page');
@@ -342,27 +338,17 @@ module.exports = function(crowi, app) {
     const portalPath = pathUtils.addTrailingSlash(getPathFromRequest(req));
     const portalPath = pathUtils.addTrailingSlash(getPathFromRequest(req));
     const revisionId = req.query.revision;
     const revisionId = req.query.revision;
 
 
-    // check whether this page has portal page
-    const portalPageStatus = await getPortalPageState(portalPath, req.user);
-
-    let view = 'customlayout-selector/page_list';
+    const view = 'customlayout-selector/page_list';
     const renderVars = { path: portalPath };
     const renderVars = { path: portalPath };
 
 
-    if (portalPageStatus === PORTAL_STATUS_FORBIDDEN) {
-      // inject to req
-      req.isForbidden = true;
-      view = 'customlayout-selector/forbidden';
-    }
-    else if (portalPageStatus === PORTAL_STATUS_EXISTS) {
-      let portalPage = await Page.findByPathAndViewer(portalPath, req.user);
-      portalPage.initLatestRevisionField(revisionId);
+    let portalPage = await Page.findByPathAndViewer(portalPath, req.user);
+    portalPage.initLatestRevisionField(revisionId);
 
 
-      // populate
-      portalPage = await portalPage.populateDataToShowRevision();
+    // populate
+    portalPage = await portalPage.populateDataToShowRevision();
 
 
-      addRendarVarsForPage(renderVars, portalPage);
-      await addRenderVarsForSlack(renderVars, portalPage);
-    }
+    addRendarVarsForPage(renderVars, portalPage);
+    await addRenderVarsForSlack(renderVars, portalPage);
 
 
     const limit = 50;
     const limit = 50;
     const offset = parseInt(req.query.offset) || 0;
     const offset = parseInt(req.query.offset) || 0;
@@ -427,25 +413,6 @@ module.exports = function(crowi, app) {
     return channels;
     return channels;
   };
   };
 
 
-  /**
-   *
-   * @param {string} path
-   * @param {User} user
-   * @returns {number} PORTAL_STATUS_NOT_EXISTS(0) or PORTAL_STATUS_EXISTS(1) or PORTAL_STATUS_FORBIDDEN(2)
-   */
-  async function getPortalPageState(path, user) {
-    const portalPath = Page.addSlashOfEnd(path);
-    const page = await Page.findByPathAndViewer(portalPath, user);
-
-    if (page == null) {
-      // check the page is forbidden or just does not exist.
-      const isForbidden = await Page.count({ path: portalPath }) > 0;
-      return isForbidden ? PORTAL_STATUS_FORBIDDEN : PORTAL_STATUS_NOT_EXISTS;
-    }
-    return PORTAL_STATUS_EXISTS;
-  }
-
-
   actions.showTopPage = function(req, res) {
   actions.showTopPage = function(req, res) {
     return showPageListForCrowiBehavior(req, res);
     return showPageListForCrowiBehavior(req, res);
   };
   };
@@ -455,16 +422,9 @@ module.exports = function(crowi, app) {
    */
    */
   /* eslint-disable no-else-return */
   /* eslint-disable no-else-return */
   actions.showPageWithEndOfSlash = function(req, res, next) {
   actions.showPageWithEndOfSlash = function(req, res, next) {
-    const behaviorType = configManager.getConfig('crowi', 'customize:behavior');
-
-    if (behaviorType === 'crowi') {
-      return showPageListForCrowiBehavior(req, res, next);
-    }
-    else {
-      const path = getPathFromRequest(req); // end of slash should be omitted
-      // redirect and showPage action will be triggered
-      return res.redirect(path);
-    }
+    const path = getPathFromRequest(req); // end of slash should be omitted
+    // redirect and showPage action will be triggered
+    return res.redirect(path);
   };
   };
   /* eslint-enable no-else-return */
   /* eslint-enable no-else-return */
 
 
@@ -478,20 +438,6 @@ module.exports = function(crowi, app) {
     if (req.query.presentation) {
     if (req.query.presentation) {
       return showPageForPresentation(req, res, next);
       return showPageForPresentation(req, res, next);
     }
     }
-
-    const behaviorType = configManager.getConfig('crowi', 'customize:behavior');
-
-    // check whether this page has portal page
-    if (behaviorType === 'crowi') {
-      const portalPagePath = pathUtils.addTrailingSlash(getPathFromRequest(req));
-      const hasPortalPage = await Page.count({ path: portalPagePath }) > 0;
-
-      if (hasPortalPage) {
-        logger.debug('The portal page is found', portalPagePath);
-        return res.redirect(encodeURI(`${portalPagePath}?redirectFrom=${pathUtils.encodePagePath(req.path)}`));
-      }
-    }
-
     // delegate to showPageForGrowiBehavior
     // delegate to showPageForGrowiBehavior
     return showPageForGrowiBehavior(req, res, next);
     return showPageForGrowiBehavior(req, res, next);
   };
   };
@@ -501,16 +447,8 @@ module.exports = function(crowi, app) {
    */
    */
   /* eslint-disable no-else-return */
   /* eslint-disable no-else-return */
   actions.trashPageListShowWrapper = function(req, res) {
   actions.trashPageListShowWrapper = function(req, res) {
-    const behaviorType = configManager.getConfig('crowi', 'customize:behavior');
-
-    if (behaviorType === 'crowi') {
-      // Crowi behavior for '/trash/*'
-      return actions.deletedPageListShow(req, res);
-    }
-    else {
-      // redirect to '/trash'
-      return res.redirect('/trash');
-    }
+    // redirect to '/trash'
+    return res.redirect('/trash');
   };
   };
   /* eslint-enable no-else-return */
   /* eslint-enable no-else-return */
 
 
@@ -519,16 +457,8 @@ module.exports = function(crowi, app) {
    */
    */
   /* eslint-disable no-else-return */
   /* eslint-disable no-else-return */
   actions.trashPageShowWrapper = function(req, res) {
   actions.trashPageShowWrapper = function(req, res) {
-    const behaviorType = configManager.getConfig('crowi', 'customize:behavior');
-
-    if (behaviorType === 'crowi') {
-      // redirect to '/trash/'
-      return res.redirect('/trash/');
-    }
-    else {
-      // Crowi behavior for '/trash/*'
-      return actions.deletedPageListShow(req, res);
-    }
+    // Crowi behavior for '/trash/*'
+    return actions.deletedPageListShow(req, res);
   };
   };
   /* eslint-enable no-else-return */
   /* eslint-enable no-else-return */
 
 
@@ -537,16 +467,8 @@ module.exports = function(crowi, app) {
    */
    */
   /* eslint-disable no-else-return */
   /* eslint-disable no-else-return */
   actions.deletedPageListShowWrapper = function(req, res) {
   actions.deletedPageListShowWrapper = function(req, res) {
-    const behaviorType = configManager.getConfig('crowi', 'customize:behavior');
-
-    if (behaviorType === 'crowi') {
-      // Crowi behavior for '/trash/*'
-      return actions.deletedPageListShow(req, res);
-    }
-    else {
-      const path = `/trash${getPathFromRequest(req)}`;
-      return res.redirect(path);
-    }
+    const path = `/trash${getPathFromRequest(req)}`;
+    return res.redirect(path);
   };
   };
   /* eslint-enable no-else-return */
   /* eslint-enable no-else-return */
 
 

+ 0 - 2
src/server/views/layout-growi/page.html

@@ -34,13 +34,11 @@
 
 
   </div>
   </div>
 
 
-  {% if 'growi' === getConfig('crowi', 'customize:behavior') || 'crowi-plus' === getConfig('crowi', 'customize:behavior') %}
   <div class="row page-list d-edit-none d-print-none mt-5">
   <div class="row page-list d-edit-none d-print-none mt-5">
     <div class="col-md-10">
     <div class="col-md-10">
       {% include '../widget/page_list_and_timeline.html' %}
       {% include '../widget/page_list_and_timeline.html' %}
     </div>
     </div>
   </div>
   </div>
-  {% endif %}
 {% endblock %}
 {% endblock %}
 
 
 
 

+ 0 - 2
src/server/views/layout-growi/user_page.html

@@ -60,13 +60,11 @@
 
 
   </div>
   </div>
 
 
-  {% if 'growi' === getConfig('crowi', 'customize:behavior') || 'crowi-plus' === getConfig('crowi', 'customize:behavior') %}
   <div class="row page-list d-edit-none d-print-none mt-5">
   <div class="row page-list d-edit-none d-print-none mt-5">
     <div class="col-md-10">
     <div class="col-md-10">
       {% include '../widget/page_list_and_timeline.html' %}
       {% include '../widget/page_list_and_timeline.html' %}
     </div>
     </div>
   </div>
   </div>
-  {% endif %}
 
 
 {% endblock %}
 {% endblock %}
 
 

+ 0 - 6
src/server/views/layout-growi/widget/header.html

@@ -1,7 +1 @@
 <div id="grw-subnav" class="grw-subnav d-edit-none" data-is-forbidden-page="{{ forbidden }}"></div>
 <div id="grw-subnav" class="grw-subnav d-edit-none" data-is-forbidden-page="{{ forbidden }}"></div>
-
-{% if not page and not forbidden and ('/' === path or 'crowi' === getConfig('crowi', 'customize:behavior')) and not isUserPageList(path) and !isTrashPage() %}
-  {% if '/' === path.slice(-1) %}
-    {% include '../../widget/create_portal.html' %}
-  {% endif %}
-{% endif %}

+ 0 - 2
src/server/views/layout-kibela/page.html

@@ -32,13 +32,11 @@
 
 
 </div>
 </div>
 
 
-  {% if 'growi' === getConfig('crowi', 'customize:behavior') || 'crowi-plus' === getConfig('crowi', 'customize:behavior') %}
   <div class="row page-list grw-pt-10px my-5 round-corner d-edit-none">
   <div class="row page-list grw-pt-10px my-5 round-corner d-edit-none">
     <div class="col-md-10">
     <div class="col-md-10">
       {% include '../widget/page_list_and_timeline.html' %}
       {% include '../widget/page_list_and_timeline.html' %}
     </div>
     </div>
   </div>
   </div>
-  {% endif %}
 {% endblock %}
 {% endblock %}
 
 
 
 

+ 0 - 2
src/server/views/layout-kibela/user_page.html

@@ -51,13 +51,11 @@
 
 
   </div>
   </div>
 
 
-  {% if 'growi' === getConfig('crowi', 'customize:behavior') || 'crowi-plus' === getConfig('crowi', 'customize:behavior') %}
   <div class="row page-list mt-5 d-edit-none">
   <div class="row page-list mt-5 d-edit-none">
     <div class="col-12">
     <div class="col-12">
       {% include '../widget/page_list_and_timeline_kibela.html' %}
       {% include '../widget/page_list_and_timeline_kibela.html' %}
     </div>
     </div>
   </div>
   </div>
-  {% endif %}
 
 
 {% endblock %}
 {% endblock %}
 
 

+ 0 - 5
src/server/views/layout-kibela/widget/header.html

@@ -1,7 +1,2 @@
 <div id="grw-subnav" class="grw-subnav" data-is-forbidden-page="{{ forbidden }}"></div>
 <div id="grw-subnav" class="grw-subnav" data-is-forbidden-page="{{ forbidden }}"></div>
 
 
-{% if not page and ('/' === path or 'crowi' === getConfig('crowi', 'customize:behavior')) and not isUserPageList(path) and !isTrashPage() %}
-  {% if '/' === path.slice(-1) %}
-    {% include '../../widget/create_portal.html' %}
-  {% endif %}
-{% endif %}

+ 0 - 4
src/server/views/widget/create_portal.html

@@ -1,4 +0,0 @@
-<div class="portal-form-button d-edit-none">
-  <a class="btn btn-primary" id="create-portal-button" href="#edit" data-toggle="tab" {% if not user %}disabled{% endif %}>Create Portal</a>
-  <p class="form-text text-muted"><a href="#" data-target="#help-portal" data-toggle="modal"><i class="icon-question"></i> What is Portal?</a></p>
-</div>

+ 0 - 3
src/server/views/widget/page_content.html

@@ -45,9 +45,6 @@
         </div>
         </div>
         <div id="page" class="mt-4"></div>
         <div id="page" class="mt-4"></div>
       </div>
       </div>
-    {% elseif 'crowi' === getConfig('crowi', 'customize:behavior') %}
-      <div class="tab-pane active" id="cancel-creating-portal">
-      </div>
     {% endif %}
     {% endif %}
 
 
     {% if !isTrashPage() %}
     {% if !isTrashPage() %}