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

+ 5 - 4
src/client/js/components/Navbar/GrowiSubNavigation.jsx

@@ -100,13 +100,14 @@ const GrowiSubNavigation = (props) => {
   const { isDrawerMode, editorMode } = navigationContainer.state;
   const {
     pageId, path, createdAt, creator, updatedAt, revisionAuthor,
-    isForbidden: isPageForbidden, pageUser, isNotCreatable, shareLinkId,
+    pageUser, isNotCreatable, shareLinkId, isPageExist, isForbidden: isPageForbidden,
   } = pageContainer.state;
+  const { isAbleToShowTagLabel } = pageContainer;
 
   const { currentUser } = appContainer;
-  const isPageNotFound = pageId == null;
   // Tags cannot be edited while the new page and editorMode is view
-  const isTagLabelHidden = (editorMode !== 'edit' && isPageNotFound);
+  const isTagLabelHidden = (editorMode !== 'edit' && !isPageExist);
+
   const isUserPage = pageUser != null;
   const isPageInTrash = isTrashPage(path);
   const isSharedPage = shareLinkId != null;
@@ -127,7 +128,7 @@ const GrowiSubNavigation = (props) => {
         ) }
 
         <div className="grw-path-nav-container">
-          { !isCompactMode && !isTagLabelHidden && !isPageForbidden && !isUserPage && !isSharedPage && (
+          { isAbleToShowTagLabel && !isCompactMode && !isTagLabelHidden && (
             <div className="mb-2">
               <TagLabels editorMode={editorMode} />
             </div>

+ 11 - 0
src/client/js/services/PageContainer.js

@@ -61,6 +61,7 @@ export default class PageContainer extends Container {
       createdAt: mainContent.getAttribute('data-page-created-at'),
       updatedAt: mainContent.getAttribute('data-page-updated-at'),
 
+      isUserPage: JSON.parse(mainContent.getAttribute('data-page-user')) != null,
       isTrashPage: isTrashPage(path),
       isForbidden: JSON.parse(mainContent.getAttribute('data-page-is-forbidden')),
       isDeleted: JSON.parse(mainContent.getAttribute('data-page-is-deleted')),
@@ -165,6 +166,16 @@ export default class PageContainer extends Container {
     return (!isTrashPage && isPageExist && !isSharedUser);
   }
 
+  /**
+   * whether to display tag labels
+   */
+  get isAbleToShowTagLabel() {
+    const { isPageForbidden, isUserPage } = this.state;
+    const { isSharedUser } = this.appContainer;
+
+    return (!isPageForbidden && !isUserPage && !isSharedUser);
+  }
+
   /**
    * initialize state for markdown data
    */