aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_reminders/src
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_reminders/src')
-rw-r--r--apps/files_reminders/src/actions/setReminderCustomAction.ts17
-rw-r--r--apps/files_reminders/src/actions/setReminderMenuAction.ts13
-rw-r--r--apps/files_reminders/src/actions/setReminderSuggestionActions.ts10
-rw-r--r--apps/files_reminders/src/components/SetCustomReminderModal.vue12
4 files changed, 38 insertions, 14 deletions
diff --git a/apps/files_reminders/src/actions/setReminderCustomAction.ts b/apps/files_reminders/src/actions/setReminderCustomAction.ts
index 0c932fa4799..ea21293ee52 100644
--- a/apps/files_reminders/src/actions/setReminderCustomAction.ts
+++ b/apps/files_reminders/src/actions/setReminderCustomAction.ts
@@ -14,12 +14,21 @@ 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: (_nodes: Node[], view: View) => {
- return view.id !== 'trashbin'
+ 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,
diff --git a/apps/files_reminders/src/actions/setReminderMenuAction.ts b/apps/files_reminders/src/actions/setReminderMenuAction.ts
index f42277b055a..d6ddcd90677 100644
--- a/apps/files_reminders/src/actions/setReminderMenuAction.ts
+++ b/apps/files_reminders/src/actions/setReminderMenuAction.ts
@@ -16,8 +16,17 @@ export const action = new FileAction({
displayName: () => t('files_reminders', 'Set reminder'),
iconSvgInline: () => AlarmSvg,
- enabled: (_nodes: Node[], view: View) => {
- return view.id !== 'trashbin'
+ 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() {
diff --git a/apps/files_reminders/src/actions/setReminderSuggestionActions.ts b/apps/files_reminders/src/actions/setReminderSuggestionActions.ts
index fae18d758a8..f92b2f89108 100644
--- a/apps/files_reminders/src/actions/setReminderSuggestionActions.ts
+++ b/apps/files_reminders/src/actions/setReminderSuggestionActions.ts
@@ -74,11 +74,17 @@ const generateFileAction = (option: ReminderOption): FileAction|null => {
// Empty svg to hide the icon
iconSvgInline: () => '<svg></svg>',
- enabled: (_nodes: Node[], view: View) => {
+ enabled: (nodes: Node[], view: View) => {
if (view.id === 'trashbin') {
return false
}
- return Boolean(getDateTime(option.dateTimePreset))
+ // 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,
diff --git a/apps/files_reminders/src/components/SetCustomReminderModal.vue b/apps/files_reminders/src/components/SetCustomReminderModal.vue
index 8996c722285..59c0886a009 100644
--- a/apps/files_reminders/src/components/SetCustomReminderModal.vue
+++ b/apps/files_reminders/src/components/SetCustomReminderModal.vue
@@ -59,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'
@@ -106,7 +106,7 @@ export default Vue.extend({
},
label(): string {
- return t('files_reminders', 'Set reminder at custom date & time')
+ return t('files_reminders', 'Reminder at custom date & time')
},
clearAriaLabel(): string {