2
0
Эх сурвалжийг харах

Merge branch 'support/share-link-for-outside-for-merge' into imprv/sharelink-copy-on-modal

# Conflicts:
#	src/client/js/components/ShareLinkList.jsx
ryohek 5 жил өмнө
parent
commit
59cc8b3cd7

+ 2 - 1
src/client/js/components/Admin/Security/ShareLinkSetting.jsx

@@ -1,6 +1,7 @@
 import React, { Fragment } from 'react';
 import PropTypes from 'prop-types';
 import { withTranslation } from 'react-i18next';
+import dateFnsFormat from 'date-fns/format';
 
 import { withUnstatedContainers } from '../../UnstatedUtils';
 import { toastSuccess, toastError } from '../../../util/apiNotification';
@@ -134,7 +135,7 @@ class ShareLinkSetting extends React.Component {
                   <tr key={sharelink._id}>
                     <td>{sharelink._id}</td>
                     <td><a href={sharelink.relatedPage.path}>{sharelink.relatedPage.path}</a></td>
-                    <td>{sharelink.expiredAt}</td>
+                    <td>{sharelink.expiredAt && <span>{dateFnsFormat(new Date(sharelink.expiredAt), 'yyyy-MM-dd HH:mm')}</span>}</td>
                     <td>{sharelink.description}</td>
                     <td>
                       <button

+ 1 - 0
src/client/js/components/OutsideShareLinkModal.jsx

@@ -52,6 +52,7 @@ class OutsideShareLinkModal extends React.Component {
 
   toggleShareLinkFormHandler() {
     this.setState({ isOpenShareLinkForm: !this.state.isOpenShareLinkForm });
+    this.retrieveShareLinks();
   }
 
   async deleteAllLinksButtonHandler() {

+ 3 - 1
src/client/js/components/ShareLinkForm.jsx

@@ -105,7 +105,9 @@ class ShareLinkForm extends React.Component {
   }
 
   async handleIssueShareLink() {
-    const { t, appContainer, pageContainer } = this.props;
+    const {
+      t, appContainer, pageContainer,
+    } = this.props;
     const { pageId } = pageContainer.state;
     const { description } = this.state;
 

+ 2 - 1
src/client/js/components/ShareLinkList.jsx

@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
 
 
 import { withTranslation } from 'react-i18next';
+import dateFnsFormat from 'date-fns/format';
 
 import { withUnstatedContainers } from './UnstatedUtils';
 
@@ -27,7 +28,7 @@ const ShareLinkList = (props) => {
               <span>{shareLink._id}</span>
               <CopyDropdown isShareLinkMode="true" shareLinkId={shareLink._id} pageId={shareLink.relatedPage} />
             </td>
-            <td>{shareLink.expiredAt}</td>
+            <td>{shareLink.expiredAt && <span>{dateFnsFormat(new Date(shareLink.expiredAt), 'yyyy-MM-dd HH:mm')}</span>}</td>
             <td>{shareLink.description}</td>
             <td>
               <button className="btn btn-outline-warning" type="button" onClick={() => deleteLinkHandler(shareLink._id)}>