Skip to content

Commit

Permalink
Merge pull request #45227 from nextcloud/fix/set-reminder-trash
Browse files Browse the repository at this point in the history
fix: Remove reminder action from trash
  • Loading branch information
Pytal authored May 14, 2024
2 parents 28564f9 + 8138516 commit 2b2a866
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
10 changes: 8 additions & 2 deletions apps/files_reminders/src/actions/setReminderCustomAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
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'

Expand All @@ -32,7 +35,10 @@ export const action = new FileAction({
title: () => t('files_reminders', 'Set reminder at custom date & time'),
iconSvgInline: () => CalendarClockSvg,

enabled: () => true,
enabled: (_nodes: Node[], view: View) => {
return view.id !== 'trashbin'
},

parent: SET_REMINDER_MENU_ID,

async exec(file: Node) {
Expand Down
7 changes: 6 additions & 1 deletion apps/files_reminders/src/actions/setReminderMenuAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

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'
Expand All @@ -30,7 +33,9 @@ export const action = new FileAction({
displayName: () => t('files_reminders', 'Set reminder'),
iconSvgInline: () => AlarmSvg,

enabled: () => true,
enabled: (_nodes: Node[], view: View) => {
return view.id !== 'trashbin'
},

async exec() {
return null
Expand Down
10 changes: 8 additions & 2 deletions apps/files_reminders/src/actions/setReminderSuggestionActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/

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'
Expand Down Expand Up @@ -91,7 +91,13 @@ 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
}
return Boolean(getDateTime(option.dateTimePreset))
},

parent: SET_REMINDER_MENU_ID,

async exec(node: Node) {
Expand Down
6 changes: 3 additions & 3 deletions dist/files_reminders-init.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files_reminders-init.js.map

Large diffs are not rendered by default.

0 comments on commit 2b2a866

Please sign in to comment.