diff options
Diffstat (limited to 'apps/files_reminders/src/actions/setReminderMenuAction.ts')
-rw-r--r-- | apps/files_reminders/src/actions/setReminderMenuAction.ts | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/apps/files_reminders/src/actions/setReminderMenuAction.ts b/apps/files_reminders/src/actions/setReminderMenuAction.ts index 20a4e89d2e9..d6ddcd90677 100644 --- a/apps/files_reminders/src/actions/setReminderMenuAction.ts +++ b/apps/files_reminders/src/actions/setReminderMenuAction.ts @@ -1,24 +1,10 @@ /** - * @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 type { Node, View } from '@nextcloud/files' + import { FileAction } from '@nextcloud/files' import { translate as t } from '@nextcloud/l10n' import AlarmSvg from '@mdi/svg/svg/alarm.svg?raw' @@ -30,7 +16,18 @@ export const action = new FileAction({ displayName: () => t('files_reminders', 'Set reminder'), iconSvgInline: () => AlarmSvg, - 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 + }, async exec() { return null |