Parcourir la source

Merge pull request #2609 from weseek/fix/adjust-share-page-alert

Fix/adjust share page alert
Yuki Takei il y a 5 ans
Parent
commit
592d4b8539

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

@@ -274,7 +274,8 @@
       "restricted": "Access to this page is restricted",
       "stale": "More than {{count}} year has passed since last update.",
       "stale_plural": "More than {{count}} years has passed since last update.",
-      "expiration": "This share link will expire <strong>{{expiredAt}}</strong>."
+      "expiration": "This share link will expire at <strong>{{expiredAt}}</strong>.",
+      "no_deadline":"This page has no expiration date"
     }
   },
   "page_edit": {

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

@@ -276,7 +276,8 @@
       "unlinked": "このページへのリダイレクトは削除されました。",
       "restricted": "このページの閲覧は制限されています",
       "stale": "このページは最終更新日から{{count}}年以上が経過しています。",
-      "expiration": "この共有パーマリンクの有効期限は <strong>{{expiredAt}}</strong> です。"
+      "expiration": "この共有パーマリンクの有効期限は <strong>{{expiredAt}}</strong> です。",
+      "no_deadline": "このページに有効期限は設定されていません。"
     }
   },
   "page_edit": {

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

@@ -249,7 +249,8 @@
 			"unlinked": "将网页重定向到此网页已被删除。",
 			"restricted": "访问此页受到限制",
 			"stale": "自上次更新以来,已超过{{count}年。",
-			"stale_plural": "自上次更新以来已过去{{count}年以上。"
+      "stale_plural": "自上次更新以来已过去{{count}年以上。",
+      "no_deadline": "This page has no expiration date"
 		}
 	},
 	"page_edit": {

+ 5 - 6
src/client/js/components/Page/ShareLinkAlert.jsx

@@ -8,7 +8,7 @@ const ShareLinkAlert = (props) => {
 
 
   const shareContent = document.getElementById('is-shared-page');
-  let expiredAt = shareContent.getAttribute('data-share-link-expired-at');
+  const expiredAt = shareContent.getAttribute('data-share-link-expired-at');
   const createdAt = shareContent.getAttribute('data-share-link-created-at');
 
   function generateRatio() {
@@ -22,9 +22,6 @@ const ShareLinkAlert = (props) => {
   if (expiredAt !== '') {
     ratio = generateRatio();
   }
-  else {
-    expiredAt = t('share_links.Unlimited');
-  }
 
   function specifyColor() {
     let color;
@@ -46,8 +43,10 @@ const ShareLinkAlert = (props) => {
   return (
     <p className={`alert alert-${specifyColor()} py-3 px-4`}>
       <i className="icon-fw icon-link"></i>
-      {/* eslint-disable-next-line react/no-danger */}
-      <span dangerouslySetInnerHTML={{ __html: t('page_page.notice.expiration', { expiredAt }) }} />
+      {(expiredAt === '' ? <span>{t('page_page.notice.no_deadline')}</span>
+      // eslint-disable-next-line react/no-danger
+      : <span dangerouslySetInnerHTML={{ __html: t('page_page.notice.expiration', { expiredAt }) }} />
+      )}
     </p>
   );
 };