Просмотр исходного кода

Added toaster & Added translation

hakumizuki 4 лет назад
Родитель
Сommit
aa258ad0bb

+ 1 - 0
resource/locales/en_US/translation.json

@@ -441,6 +441,7 @@
     "remove_share_link_success": "Succeeded to remove {{shareLinkId}}",
     "remove_share_link_success": "Succeeded to remove {{shareLinkId}}",
     "issue_share_link": "Succeeded to issue new share link",
     "issue_share_link": "Succeeded to issue new share link",
     "remove_share_link": "Succeeded to remove {{count}} share links",
     "remove_share_link": "Succeeded to remove {{count}} share links",
+    "switch_disable_link_sharing_success": "Succeeded to update share link setting",
     "failed_to_reset_password":"Failed to reset password"
     "failed_to_reset_password":"Failed to reset password"
   },
   },
   "template": {
   "template": {

+ 1 - 0
resource/locales/ja_JP/translation.json

@@ -443,6 +443,7 @@
     "remove_share_link_success": "{{shareLinkId}}を削除しました",
     "remove_share_link_success": "{{shareLinkId}}を削除しました",
     "issue_share_link": "共有リンクを作成しました",
     "issue_share_link": "共有リンクを作成しました",
     "remove_share_link": "共有リンクを{{count}}件削除しました",
     "remove_share_link": "共有リンクを{{count}}件削除しました",
+    "switch_disable_link_sharing_success": "共有リンクの設定を変更しました",
     "failed_to_reset_password":"パスワードのリセットに失敗しました"
     "failed_to_reset_password":"パスワードのリセットに失敗しました"
   },
   },
   "template": {
   "template": {

+ 1 - 0
resource/locales/zh_CN/translation.json

@@ -418,6 +418,7 @@
 		"deactivate_user_success": "Succeeded to deactivate {{username}}",
 		"deactivate_user_success": "Succeeded to deactivate {{username}}",
 		"remove_user_success": "Succeeded to removing {{username}} ",
 		"remove_user_success": "Succeeded to removing {{username}} ",
     "remove_external_user_success": "Succeeded to remove {{accountId}} ",
     "remove_external_user_success": "Succeeded to remove {{accountId}} ",
+    "switch_disable_link_sharing_success": "成功更新分享链接设置",
     "failed_to_reset_password":"Failed to reset password"
     "failed_to_reset_password":"Failed to reset password"
   },
   },
 	"template": {
 	"template": {

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

@@ -51,6 +51,7 @@ class ShareLinkSetting extends React.Component {
     this.closeDeleteConfirmModal = this.closeDeleteConfirmModal.bind(this);
     this.closeDeleteConfirmModal = this.closeDeleteConfirmModal.bind(this);
     this.deleteAllLinksButtonHandler = this.deleteAllLinksButtonHandler.bind(this);
     this.deleteAllLinksButtonHandler = this.deleteAllLinksButtonHandler.bind(this);
     this.deleteLinkById = this.deleteLinkById.bind(this);
     this.deleteLinkById = this.deleteLinkById.bind(this);
+    this.switchDisableLinkSharing = this.switchDisableLinkSharing.bind(this);
   }
   }
 
 
   componentWillMount() {
   componentWillMount() {
@@ -105,6 +106,17 @@ class ShareLinkSetting extends React.Component {
     this.getShareLinkList(shareLinksActivePage);
     this.getShareLinkList(shareLinksActivePage);
   }
   }
 
 
+  async switchDisableLinkSharing() {
+    const { t, adminGeneralSecurityContainer } = this.props;
+    try {
+      await adminGeneralSecurityContainer.switchDisableLinkSharing();
+      toastSuccess(t('toaster.switch_disable_link_sharing_success'));
+    }
+    catch (err) {
+      toastError(err);
+    }
+  }
+
 
 
   render() {
   render() {
     const { t, adminGeneralSecurityContainer } = this.props;
     const { t, adminGeneralSecurityContainer } = this.props;
@@ -134,7 +146,7 @@ class ShareLinkSetting extends React.Component {
                 className="custom-control-input"
                 className="custom-control-input"
                 id="disableLinkSharing"
                 id="disableLinkSharing"
                 checked={!disableLinkSharing}
                 checked={!disableLinkSharing}
-                onChange={() => adminGeneralSecurityContainer.switchDisableLinkSharing()}
+                onChange={() => this.switchDisableLinkSharing()}
               />
               />
               <label className="custom-control-label" htmlFor="disableLinkSharing">
               <label className="custom-control-label" htmlFor="disableLinkSharing">
                 {t('security_setting.enable_link_sharing')}
                 {t('security_setting.enable_link_sharing')}

+ 6 - 11
src/client/js/services/AdminGeneralSecurityContainer.js

@@ -150,17 +150,12 @@ export default class AdminGeneralSecurityContainer extends Container {
    * Switch disableLinkSharing
    * Switch disableLinkSharing
    */
    */
   async switchDisableLinkSharing() {
   async switchDisableLinkSharing() {
-    try {
-      const requestParams = {
-        disableLinkSharing: !this.state.disableLinkSharing,
-      };
-      const response = await this.appContainer.apiv3.put('/security-setting/share-link-setting', requestParams);
-      this.setDisableLinkSharing(!this.state.disableLinkSharing);
-      return response;
-    }
-    catch (err) {
-      toastError(err);
-    }
+    const requestParams = {
+      disableLinkSharing: !this.state.disableLinkSharing,
+    };
+    const response = await this.appContainer.apiv3.put('/security-setting/share-link-setting', requestParams);
+    this.setDisableLinkSharing(!this.state.disableLinkSharing);
+    return response;
   }
   }
 
 
   /**
   /**