Преглед изворни кода

Merge pull request #2487 from weseek/fix/guest-mode

Fix/guest mode
itizawa пре 5 година
родитељ
комит
c5091f8681

+ 4 - 0
src/client/js/components/Page/PageManagement.jsx

@@ -83,6 +83,10 @@ const PageManagement = (props) => {
   }
 
   function renderModals() {
+    if (currentUser == null) {
+      return null;
+    }
+
     return (
       <>
         <PageRenameModal

+ 4 - 0
src/client/js/components/Page/PageShareManagement.jsx

@@ -24,6 +24,10 @@ const PageShareManagement = (props) => {
   }
 
   function renderModals() {
+    if (currentUser == null) {
+      return null;
+    }
+
     return (
       <>
         <OutsideShareLinkModal

+ 3 - 2
src/client/js/components/Sidebar.jsx

@@ -146,7 +146,6 @@ class Sidebar extends React.Component {
 
   renderSidebarContents = () => {
     const scrollTargetSelector = 'div[data-testid="ContextualNavigation"] div[role="group"]';
-
     return (
       <>
         <StickyStretchableScroller
@@ -156,7 +155,9 @@ class Sidebar extends React.Component {
           calcViewHeightFunc={this.calcViewHeight}
         />
         <div id="grw-sidebar-content-container" className="grw-sidebar-content-container">
-          <SidebarContents />
+          <SidebarContents
+            isSharedUser={this.props.appContainer.isSharedUser}
+          />
         </div>
       </>
     );

+ 10 - 1
src/client/js/components/Sidebar/SidebarContents.jsx

@@ -10,8 +10,11 @@ import RecentChanges from './RecentChanges';
 import CustomSidebar from './CustomSidebar';
 
 const SidebarContents = (props) => {
+  const { navigationContainer, isSharedUser } = props;
 
-  const { navigationContainer } = props;
+  if (isSharedUser) {
+    return null;
+  }
 
   let Contents;
   switch (navigationContainer.state.sidebarContentsId) {
@@ -30,6 +33,12 @@ const SidebarContents = (props) => {
 
 SidebarContents.propTypes = {
   navigationContainer: PropTypes.instanceOf(NavigationContainer).isRequired,
+
+  isSharedUser: PropTypes.bool,
+};
+
+SidebarContents.defaultProps = {
+  isSharedUser: false,
 };
 
 /**

+ 1 - 0
src/client/styles/scss/_sidebar.scss

@@ -94,6 +94,7 @@
   }
 
   .grw-sidebar-nav {
+    min-width: 62px;
     height: 100vh;
 
     .btn {

+ 1 - 2
src/server/views/layout-growi/shared_page.html

@@ -17,7 +17,7 @@
   <div class="row" id="is-shared-page" data-share-link-expired-at="{% if sharelink.expiredAt %}{{ sharelink.expiredAt|datetz('Y/m/d H:i:s')}}{% endif %}" data-share-link-created-at="{{ sharelink.createdAt|datetz('Y/m/d H:i:s')}}">
     {% block content_page %}
       <div class="col grw-page-content-container">
-      <div id="share-link-alert"></div>
+        <div id="share-link-alert"></div>
 
         {% include '../widget/page_content.html' %}
         {# force remove #revision-toc from #content_main of parent #}
@@ -36,7 +36,6 @@
     {% endblock %}
 
   </div>
-
 {% endblock %}