Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: rename 'edit locally' to 'open locally' #50957

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
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
4 changes: 2 additions & 2 deletions dist/files-init.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

Loading