Skip to content

Commit

Permalink
fix: rename 'edit locally' to 'open locally'
Browse files Browse the repository at this point in the history
Replace "Edit" by "Open"

Signed-off-by: Jérôme Herbinet <33763786+Jerome-Herbinet@users.noreply.github.com>
  • Loading branch information
Jerome-Herbinet authored and susnux committed Feb 21, 2025
1 parent 6cd3046 commit e3d8edb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { beforeAll, beforeEach, describe, expect, test, vi } from 'vitest'

import axios from '@nextcloud/axios'
import * as nextcloudDialogs from '@nextcloud/dialogs'
import { action } from './editLocallyAction'
import { action } from './openLocallyAction'

vi.mock('@nextcloud/auth')
vi.mock('@nextcloud/axios')
Expand All @@ -25,18 +25,18 @@ beforeAll(() => {
(window as any).OCA = { Viewer: { open: vi.fn() } }
})

describe('Edit locally action conditions tests', () => {
describe('Open locally action conditions tests', () => {
test('Default values', () => {
expect(action).toBeInstanceOf(FileAction)
expect(action.id).toBe('edit-locally')
expect(action.displayName([], view)).toBe('Edit locally')
expect(action.displayName([], view)).toBe('Open locally')
expect(action.iconSvgInline([], view)).toMatch(/<svg.+<\/svg>/)
expect(action.default).toBeUndefined()
expect(action.order).toBe(25)
})
})

describe('Edit locally action enabled tests', () => {
describe('Open locally action enabled tests', () => {
test('Enabled for file with UPDATE permission', () => {
const file = new File({
id: 1,
Expand Down Expand Up @@ -108,15 +108,15 @@ describe('Edit locally action enabled tests', () => {
})
})

describe('Edit locally action execute tests', () => {
describe('Open locally action execute tests', () => {
let spyShowDialog
beforeEach(() => {
vi.resetAllMocks()
spyShowDialog = vi.spyOn(nextcloudDialogs.Dialog.prototype, 'show')
.mockImplementation(() => Promise.resolve())
})

test('Edit locally opens proper URL', async () => {
test('Open locally opens proper URL', async () => {
vi.spyOn(axios, 'post').mockImplementation(async () => ({
data: { ocs: { data: { token: 'foobar' } } },
}))
Expand All @@ -143,7 +143,7 @@ describe('Edit locally action execute tests', () => {
expect(windowOpenSpy).toBeCalledWith('nc://open/test@nextcloud.local/foobar.txt?token=foobar', '_self')
})

test('Edit locally fails and shows error', async () => {
test('Open locally fails and shows error', async () => {
vi.spyOn(axios, 'post').mockImplementation(async () => ({}))
const showError = vi.spyOn(nextcloudDialogs, 'showError')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const confirmLocalEditDialog = (
let callbackCalled = false

return (new DialogBuilder())
.setName(t('files', 'Edit file locally'))
.setName(t('files', 'Open file locally'))
.setText(t('files', 'The file should now open on your device. If it doesn\'t, please check that you have the desktop app installed.'))
.setButtons([
{
Expand All @@ -31,7 +31,7 @@ const confirmLocalEditDialog = (
},
},
{
label: t('files', 'Edit online'),
label: t('files', 'Open online'),
icon: IconWeb,
type: 'primary',
callback: () => {
Expand Down Expand Up @@ -80,7 +80,7 @@ const openLocalClient = async function(path: string) {

export const action = new FileAction({
id: 'edit-locally',
displayName: () => t('files', 'Edit locally'),
displayName: () => t('files', 'Open locally'),
iconSvgInline: () => LaptopSvg,

// Only works on single files
Expand Down
2 changes: 1 addition & 1 deletion apps/files/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { addNewFileMenuEntry, registerDavProperty, registerFileAction } from '@n

import { action as deleteAction } from './actions/deleteAction'
import { action as downloadAction } from './actions/downloadAction'
import { action as editLocallyAction } from './actions/editLocallyAction'
import { action as editLocallyAction } from './actions/openLocallyAction.ts'
import { action as favoriteAction } from './actions/favoriteAction'
import { action as moveOrCopyAction } from './actions/moveOrCopyAction'
import { action as openFolderAction } from './actions/openFolderAction'
Expand Down

0 comments on commit e3d8edb

Please sign in to comment.