diff options
Diffstat (limited to 'apps/files_reminders/src')
13 files changed, 93 insertions, 273 deletions
diff --git a/apps/files_reminders/src/actions/clearReminderAction.ts b/apps/files_reminders/src/actions/clearReminderAction.ts index b8d1d55a5fb..148861999f4 100644 --- a/apps/files_reminders/src/actions/clearReminderAction.ts +++ b/apps/files_reminders/src/actions/clearReminderAction.ts @@ -1,23 +1,6 @@ /** - * @copyright 2024 Christopher Ng <chrng8@gmail.com> - * - * @author Christopher Ng <chrng8@gmail.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: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ import Vue from 'vue' diff --git a/apps/files_reminders/src/actions/reminderStatusAction.ts b/apps/files_reminders/src/actions/reminderStatusAction.ts index ec82f52cfc2..6a2c9943d3b 100644 --- a/apps/files_reminders/src/actions/reminderStatusAction.ts +++ b/apps/files_reminders/src/actions/reminderStatusAction.ts @@ -1,23 +1,6 @@ /** - * @copyright 2024 Christopher Ng <chrng8@gmail.com> - * - * @author Christopher Ng <chrng8@gmail.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: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ import { FileAction, type Node } from '@nextcloud/files' 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) { 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 diff --git a/apps/files_reminders/src/actions/setReminderSuggestionActions.scss b/apps/files_reminders/src/actions/setReminderSuggestionActions.scss index 93a94bafa2b..1327500c964 100644 --- a/apps/files_reminders/src/actions/setReminderSuggestionActions.scss +++ b/apps/files_reminders/src/actions/setReminderSuggestionActions.scss @@ -1,23 +1,6 @@ /** - * @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 */ // TODO: remove when/if the actions API supports a separator // This the last preset action, so we need to add a separator @@ -27,14 +10,14 @@ &::before { content: ""; - margin: 3px 10px 3px 15px; + margin-block: 3px; + margin-inline: 15px 10px; border-bottom: 1px solid var(--color-border-dark); cursor: default; display: flex; height: 0; position: absolute; - left: 0; - right: 0; + inset-inline: 0; top: -10px; } } diff --git a/apps/files_reminders/src/actions/setReminderSuggestionActions.ts b/apps/files_reminders/src/actions/setReminderSuggestionActions.ts index e713f51ec7c..f92b2f89108 100644 --- a/apps/files_reminders/src/actions/setReminderSuggestionActions.ts +++ b/apps/files_reminders/src/actions/setReminderSuggestionActions.ts @@ -1,27 +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 Vue from 'vue' -import type { Node } from '@nextcloud/files' +import type { Node, View } from '@nextcloud/files' import { FileAction } from '@nextcloud/files' import { emit } from '@nextcloud/event-bus' @@ -48,7 +31,7 @@ const laterToday: ReminderOption = { label: t('files_reminders', 'Later today'), ariaLabel: t('files_reminders', 'Set reminder for later today'), dateString: '', - verboseDateString: '' + verboseDateString: '', } const tomorrow: ReminderOption = { @@ -56,7 +39,7 @@ const tomorrow: ReminderOption = { label: t('files_reminders', 'Tomorrow'), ariaLabel: t('files_reminders', 'Set reminder for tomorrow'), dateString: '', - verboseDateString: '' + verboseDateString: '', } const thisWeekend: ReminderOption = { @@ -64,7 +47,7 @@ const thisWeekend: ReminderOption = { label: t('files_reminders', 'This weekend'), ariaLabel: t('files_reminders', 'Set reminder for this weekend'), dateString: '', - verboseDateString: '' + verboseDateString: '', } const nextWeek: ReminderOption = { @@ -72,7 +55,7 @@ const nextWeek: ReminderOption = { label: t('files_reminders', 'Next week'), ariaLabel: t('files_reminders', 'Set reminder for next week'), dateString: '', - verboseDateString: '' + verboseDateString: '', } /** @@ -91,7 +74,19 @@ const generateFileAction = (option: ReminderOption): FileAction|null => { // Empty svg to hide the icon iconSvgInline: () => '<svg></svg>', - enabled: () => Boolean(getDateTime(option.dateTimePreset)), + 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 && Boolean(getDateTime(option.dateTimePreset)) + }, + parent: SET_REMINDER_MENU_ID, async exec(node: Node) { diff --git a/apps/files_reminders/src/components/SetCustomReminderModal.vue b/apps/files_reminders/src/components/SetCustomReminderModal.vue index fdbe5d24855..59c0886a009 100644 --- a/apps/files_reminders/src/components/SetCustomReminderModal.vue +++ b/apps/files_reminders/src/components/SetCustomReminderModal.vue @@ -1,23 +1,6 @@ <!-- - - @copyright 2023 Christopher Ng <chrng8@gmail.com> - - - - @author Christopher Ng <chrng8@gmail.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 --> <template> @@ -76,11 +59,11 @@ import { emit } from '@nextcloud/event-bus' import { showError, showSuccess } from '@nextcloud/dialogs' import { translate as t } from '@nextcloud/l10n' -import NcButton from '@nextcloud/vue/dist/Components/NcButton.js' -import NcDateTime from '@nextcloud/vue/dist/Components/NcDateTime.js' -import NcDateTimePickerNative from '@nextcloud/vue/dist/Components/NcDateTimePickerNative.js' -import NcDialog from '@nextcloud/vue/dist/Components/NcDialog.js' -import NcNoteCard from '@nextcloud/vue/dist/Components/NcNoteCard.js' +import NcButton from '@nextcloud/vue/components/NcButton' +import NcDateTime from '@nextcloud/vue/components/NcDateTime' +import NcDateTimePickerNative from '@nextcloud/vue/components/NcDateTimePickerNative' +import NcDialog from '@nextcloud/vue/components/NcDialog' +import NcNoteCard from '@nextcloud/vue/components/NcNoteCard' import { getDateString, getInitialCustomDueDate } from '../shared/utils.ts' import { logger } from '../shared/logger.ts' @@ -110,20 +93,20 @@ export default Vue.extend({ }, computed: { - fileId(): number { - return this.node.fileid + fileId(): number|undefined { + return this.node?.fileid }, - fileName(): string { - return this.node.basename + fileName(): string|undefined { + return this.node?.basename }, name() { - return t('files_reminders', 'Set reminder for "{fileName}"', { fileName: this.fileName }) + return this.fileName ? t('files_reminders', 'Set reminder for "{fileName}"', { fileName: this.fileName }) : '' }, label(): string { - return t('files_reminders', 'Set reminder at custom date & time') + return t('files_reminders', 'Reminder at custom date & time') }, clearAriaLabel(): string { diff --git a/apps/files_reminders/src/init.ts b/apps/files_reminders/src/init.ts index 74063dbff4c..17da254d0f2 100644 --- a/apps/files_reminders/src/init.ts +++ b/apps/files_reminders/src/init.ts @@ -1,23 +1,6 @@ /** - * @copyright 2023 Christopher Ng <chrng8@gmail.com> - * - * @author Christopher Ng <chrng8@gmail.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 { registerDavProperty, registerFileAction } from '@nextcloud/files' diff --git a/apps/files_reminders/src/services/customPicker.ts b/apps/files_reminders/src/services/customPicker.ts index 1f52a7b2b55..5cefffe39a5 100644 --- a/apps/files_reminders/src/services/customPicker.ts +++ b/apps/files_reminders/src/services/customPicker.ts @@ -1,23 +1,6 @@ /** - * @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 } from '@nextcloud/files' diff --git a/apps/files_reminders/src/services/reminderService.ts b/apps/files_reminders/src/services/reminderService.ts index 06163b601cb..9f58d1bdae3 100644 --- a/apps/files_reminders/src/services/reminderService.ts +++ b/apps/files_reminders/src/services/reminderService.ts @@ -1,23 +1,6 @@ /** - * @copyright 2023 Christopher Ng <chrng8@gmail.com> - * - * @author Christopher Ng <chrng8@gmail.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 axios from '@nextcloud/axios' diff --git a/apps/files_reminders/src/shared/logger.ts b/apps/files_reminders/src/shared/logger.ts index 116acf0c81e..79d663cca16 100644 --- a/apps/files_reminders/src/shared/logger.ts +++ b/apps/files_reminders/src/shared/logger.ts @@ -1,23 +1,6 @@ /** - * @copyright 2023 Christopher Ng <chrng8@gmail.com> - * - * @author Christopher Ng <chrng8@gmail.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 { getLoggerBuilder } from '@nextcloud/logger' diff --git a/apps/files_reminders/src/shared/types.ts b/apps/files_reminders/src/shared/types.ts index c5725fd1d06..f8da6f6aed0 100644 --- a/apps/files_reminders/src/shared/types.ts +++ b/apps/files_reminders/src/shared/types.ts @@ -1,27 +1,10 @@ /** - * @copyright 2023 Christopher Ng <chrng8@gmail.com> - * - * @author Christopher Ng <chrng8@gmail.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 */ export interface FileAttributes { - [key: string]: any + [key: string]: unknown id: number name: string } diff --git a/apps/files_reminders/src/shared/utils.ts b/apps/files_reminders/src/shared/utils.ts index 1db42dd1392..5d583ad3ddd 100644 --- a/apps/files_reminders/src/shared/utils.ts +++ b/apps/files_reminders/src/shared/utils.ts @@ -1,23 +1,6 @@ /** - * @copyright 2023 Christopher Ng <chrng8@gmail.com> - * - * @author Christopher Ng <chrng8@gmail.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 { getCanonicalLocale } from '@nextcloud/l10n' |