Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix(files_reminders): Fix reminder actions being displayed on invalid…
… nodes

Signed-off-by: Christopher Ng <[email protected]>
  • Loading branch information
Pytal authored and backportbot[bot] committed Mar 26, 2025
commit f0f6b0b69d0088b38af2c8cafca98eeeebdbec90
13 changes: 11 additions & 2 deletions apps/files_reminders/src/actions/setReminderCustomAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,17 @@ export const action = new FileAction({
title: () => t('files_reminders', 'Set 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,
Expand Down
13 changes: 11 additions & 2 deletions apps/files_reminders/src/actions/setReminderMenuAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading