fix(files): also use open-in-files for the search view

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
Ferdinand Thiessen 2025-06-17 19:27:23 +02:00
parent 2c3774892e
commit d5a4eb8139
No known key found for this signature in database
GPG key ID: 45FAE7268762B400
3 changed files with 12 additions and 10 deletions

View file

@ -19,7 +19,7 @@ const recentView = {
describe('Open in files action conditions tests', () => {
test('Default values', () => {
expect(action).toBeInstanceOf(FileAction)
expect(action.id).toBe('open-in-files-recent')
expect(action.id).toBe('open-in-files')
expect(action.displayName([], recentView)).toBe('Open in Files')
expect(action.iconSvgInline([], recentView)).toBe('')
expect(action.default).toBe(DefaultType.HIDDEN)

View file

@ -2,19 +2,21 @@
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { translate as t } from '@nextcloud/l10n'
import { type Node, FileType, FileAction, DefaultType } from '@nextcloud/files'
/**
* TODO: Move away from a redirect and handle
* navigation straight out of the recent view
*/
import type { Node } from '@nextcloud/files'
import { t } from '@nextcloud/l10n'
import { FileType, FileAction, DefaultType } from '@nextcloud/files'
import { VIEW_ID as SEARCH_VIEW_ID } from '../views/search'
export const action = new FileAction({
id: 'open-in-files-recent',
id: 'open-in-files',
displayName: () => t('files', 'Open in Files'),
iconSvgInline: () => '',
enabled: (nodes, view) => view.id === 'recent',
enabled(nodes, view) {
return view.id === 'recent' || view.id === SEARCH_VIEW_ID
},
async exec(node: Node) {
let dir = node.dirname

View file

@ -29,7 +29,7 @@ const invalidViews = [
describe('Open in files action conditions tests', () => {
test('Default values', () => {
expect(action).toBeInstanceOf(FileAction)
expect(action.id).toBe('open-in-files')
expect(action.id).toBe('files_sharing:open-in-files')
expect(action.displayName([], validViews[0])).toBe('Open in Files')
expect(action.iconSvgInline([], validViews[0])).toBe('')
expect(action.default).toBe(DefaultType.HIDDEN)