mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-07-10 04:21:21 +02:00
web: don't allow note expiry to be set beyond 1 year in the future (#9901)
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
This commit is contained in:
@@ -54,19 +54,26 @@ export const NoteExpiryDateDialog = DialogManager.register(
|
||||
return (
|
||||
<Dialog
|
||||
isOpen={true}
|
||||
title={"Set Custom Expiry Date"}
|
||||
title={strings.setExpiry()}
|
||||
onClose={() => onClose(false)}
|
||||
width={400}
|
||||
positiveButton={{
|
||||
text: strings.done(),
|
||||
onClick: async () => {
|
||||
if (date.isBefore(dayjs())) {
|
||||
showToast("error", "Expiry date must be in the future");
|
||||
showToast("error", strings.expiryDateMustBeInTheFuture());
|
||||
return;
|
||||
}
|
||||
if (date.isAfter(dayjs().add(1, "year"))) {
|
||||
showToast(
|
||||
"error",
|
||||
strings.expiryDateCannotBeMoreThan1YearInTheFuture()
|
||||
);
|
||||
return;
|
||||
}
|
||||
await db.notes.setExpiryDate(date.valueOf(), noteId);
|
||||
store.refresh();
|
||||
showToast("success", "Expiry date set");
|
||||
showToast("success", strings.expiryDateSet());
|
||||
onClose(true);
|
||||
}
|
||||
}}
|
||||
|
||||
@@ -2767,6 +2767,18 @@ msgstr "Experience the next level of private note taking\""
|
||||
msgid "Expiry date"
|
||||
msgstr "Expiry date"
|
||||
|
||||
#: src/strings.ts:2692
|
||||
msgid "Expiry date cannot be more than 1 year in the future"
|
||||
msgstr "Expiry date cannot be more than 1 year in the future"
|
||||
|
||||
#: src/strings.ts:2690
|
||||
msgid "Expiry date must be in the future"
|
||||
msgstr "Expiry date must be in the future"
|
||||
|
||||
#: src/strings.ts:2693
|
||||
msgid "Expiry date set"
|
||||
msgstr "Expiry date set"
|
||||
|
||||
#: src/strings.ts:2550
|
||||
msgid "Explore all plans"
|
||||
msgstr "Explore all plans"
|
||||
|
||||
@@ -2756,6 +2756,18 @@ msgstr ""
|
||||
msgid "Expiry date"
|
||||
msgstr ""
|
||||
|
||||
#: src/strings.ts:2692
|
||||
msgid "Expiry date cannot be more than 1 year in the future"
|
||||
msgstr ""
|
||||
|
||||
#: src/strings.ts:2690
|
||||
msgid "Expiry date must be in the future"
|
||||
msgstr ""
|
||||
|
||||
#: src/strings.ts:2693
|
||||
msgid "Expiry date set"
|
||||
msgstr ""
|
||||
|
||||
#: src/strings.ts:2550
|
||||
msgid "Explore all plans"
|
||||
msgstr ""
|
||||
|
||||
@@ -2686,5 +2686,9 @@ Continue without attachments?`,
|
||||
openingLocalFileDesc: (filePath: string) =>
|
||||
t`Are you sure you want to open this file: ${filePath}?`,
|
||||
cantOpenFileLinksInBrowsers: () =>
|
||||
t`File links cannot be opened in browsers. Please use the Notesnook desktop app.`
|
||||
t`File links cannot be opened in browsers. Please use the Notesnook desktop app.`,
|
||||
expiryDateMustBeInTheFuture: () => t`Expiry date must be in the future`,
|
||||
expiryDateCannotBeMoreThan1YearInTheFuture: () =>
|
||||
t`Expiry date cannot be more than 1 year in the future`,
|
||||
expiryDateSet: () => t`Expiry date set`
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user