aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_reminders/src/actions/setReminderCustomAction.ts
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_reminders/src/actions/setReminderCustomAction.ts')
-rw-r--r--apps/files_reminders/src/actions/setReminderCustomAction.ts44
1 files changed, 21 insertions, 23 deletions
diff --git a/apps/files_reminders/src/actions/setReminderCustomAction.ts b/apps/files_reminders/src/actions/setReminderCustomAction.ts
index 2130adbb12d..ea21293ee52 100644
--- a/apps/files_reminders/src/actions/setReminderCustomAction.ts
+++ b/apps/files_reminders/src/actions/setReminderCustomAction.ts
@@ -1,25 +1,11 @@
/**
- * @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>
- *
- * @author John Molakvoæ <skjnldsv@protonmail.com>
- *
- * @license AGPL-3.0-or-later
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-import { FileAction, Node } from '@nextcloud/files'
+
+import type { Node, View } from '@nextcloud/files'
+
+import { FileAction } from '@nextcloud/files'
import { translate as t } from '@nextcloud/l10n'
import CalendarClockSvg from '@mdi/svg/svg/calendar-clock.svg?raw'
@@ -28,11 +14,23 @@ import { pickCustomDate } from '../services/customPicker'
export const action = new FileAction({
id: 'set-reminder-custom',
- displayName: () => t('files_reminders', 'Set custom reminder'),
- title: () => t('files_reminders', 'Set reminder at custom date & time'),
+ displayName: () => t('files_reminders', 'Custom reminder'),
+ title: () => t('files_reminders', 'Reminder at custom date & time'),
iconSvgInline: () => CalendarClockSvg,
- enabled: () => true,
+ enabled: (nodes: Node[], view: View) => {
+ if (view.id === 'trashbin') {
+ return false
+ }
+ // Only allow on a single node
+ if (nodes.length !== 1) {
+ return false
+ }
+ const node = nodes.at(0)!
+ const dueDate = node.attributes['reminder-due-date']
+ return dueDate !== undefined
+ },
+
parent: SET_REMINDER_MENU_ID,
async exec(file: Node) {