diff options
author | John Molakvoæ <skjnldsv@protonmail.com> | 2024-01-09 13:08:08 +0100 |
---|---|---|
committer | John Molakvoæ <skjnldsv@protonmail.com> | 2024-01-11 11:57:49 +0100 |
commit | 365bb7ded033db22e3560cbffa1e885cf473429a (patch) | |
tree | b98f3499938c295e5308dd5e142ddfe0c52243e8 | |
parent | 9553718acfd3c3a5fb9812765d761dfc1c00f74b (diff) | |
download | nextcloud-server-365bb7ded033db22e3560cbffa1e885cf473429a.tar.gz nextcloud-server-365bb7ded033db22e3560cbffa1e885cf473429a.zip |
chore(deps): bump `@nextcloud/files` to `3.1.0`
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
-rw-r--r-- | apps/files/src/actions/deleteAction.spec.ts | 12 | ||||
-rw-r--r-- | apps/files/src/actions/deleteAction.ts | 10 | ||||
-rw-r--r-- | apps/files/src/services/Files.ts | 2 | ||||
-rw-r--r-- | package-lock.json | 10 | ||||
-rw-r--r-- | package.json | 2 |
5 files changed, 17 insertions, 19 deletions
diff --git a/apps/files/src/actions/deleteAction.spec.ts b/apps/files/src/actions/deleteAction.spec.ts index 195d257c017..f1aee5bdcba 100644 --- a/apps/files/src/actions/deleteAction.spec.ts +++ b/apps/files/src/actions/deleteAction.spec.ts @@ -38,6 +38,10 @@ const trashbinView = { } as View describe('Delete action conditions tests', () => { + afterEach(() => { + jest.restoreAllMocks() + }) + const file = new File({ id: 1, source: 'https://cloud.domain.com/remote.php/dav/files/test/foobar.txt', @@ -48,8 +52,8 @@ describe('Delete action conditions tests', () => { const file2 = new File({ id: 1, - source: 'https://cloud.domain.com/remote.php/dav/files/test/foobar.txt', - owner: 'user2', + source: 'https://cloud.domain.com/remote.php/dav/files/admin/foobar.txt', + owner: 'admin', mime: 'text/plain', permissions: Permission.ALL, }) @@ -67,12 +71,12 @@ describe('Delete action conditions tests', () => { expect(action.displayName([file], trashbinView)).toBe('Delete permanently') }) - test('Shared node view values', () => { + test('Shared node values', () => { jest.spyOn(auth, 'getCurrentUser').mockReturnValue(null) expect(action.displayName([file2], view)).toBe('Unshare') }) - test('Shared and owned nodes view values', () => { + test('Shared and owned nodes values', () => { expect(action.displayName([file, file2], view)).toBe('Delete and unshare') }) }) diff --git a/apps/files/src/actions/deleteAction.ts b/apps/files/src/actions/deleteAction.ts index d3f3a256517..29f1cf86c9b 100644 --- a/apps/files/src/actions/deleteAction.ts +++ b/apps/files/src/actions/deleteAction.ts @@ -29,16 +29,10 @@ import CloseSvg from '@mdi/svg/svg/close.svg?raw' import logger from '../logger.js' import { getCurrentUser } from '@nextcloud/auth' -// A file which the owner is NOT the current user -// is considered shared. Other methods like group folders -// will always use the current user as the owner. -// It will therefore not be considered shared. const isAllUnshare = (nodes: Node[]) => { - return !nodes.some(node => node.owner !== getCurrentUser()?.uid) + return !nodes.some(node => node.owner === getCurrentUser()?.uid) } -// Check whether the selection contains a mix of files -// the current user owns and files owned by other users. const isMixedUnshareAndDelete = (nodes: Node[]) => { const hasUnshareItems = nodes.some(node => node.owner !== getCurrentUser()?.uid) const hasDeleteItems = nodes.some(node => node.owner === getCurrentUser()?.uid) @@ -79,7 +73,7 @@ export const action = new FileAction({ // Let's delete even if it's moved to the trashbin // since it has been removed from the current view - // and changing the view will trigger a reload anyway. + // and changing the view will trigger a reload anyway. emit('files:node:deleted', node) return true } catch (error) { diff --git a/apps/files/src/services/Files.ts b/apps/files/src/services/Files.ts index c09be2d72ac..a293154f625 100644 --- a/apps/files/src/services/Files.ts +++ b/apps/files/src/services/Files.ts @@ -42,7 +42,7 @@ interface ResponseProps extends DAVResultResponseProps { export const resultToNode = function(node: FileStat): File | Folder { const props = node.props as ResponseProps const permissions = davParsePermissions(props?.permissions) - const owner = getCurrentUser()?.uid as string + const owner = (props['owner-id'] || getCurrentUser()?.uid) as string const source = generateRemoteUrl('dav' + rootPath + node.filename) const id = props?.fileid < 0 diff --git a/package-lock.json b/package-lock.json index 8aff49b2456..3b47bd31374 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,7 @@ "@nextcloud/capabilities": "^1.0.4", "@nextcloud/dialogs": "^5.0.3", "@nextcloud/event-bus": "^3.1.0", - "@nextcloud/files": "^3.0.0", + "@nextcloud/files": "^3.1.0", "@nextcloud/initial-state": "^2.0.0", "@nextcloud/l10n": "^2.1.0", "@nextcloud/logger": "^2.5.0", @@ -3918,9 +3918,9 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, "node_modules/@nextcloud/files": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@nextcloud/files/-/files-3.0.0.tgz", - "integrity": "sha512-zk5oIuVDyk2gWBKCJ+0B1HE3VjhuGnz2iLNbTcbRuTjMYb6aYCAEn1LY0dXbUQG93ehndYJCOdaYri/TaGrlXw==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@nextcloud/files/-/files-3.1.0.tgz", + "integrity": "sha512-i0g9L5HRBJ2vr/gXYb0Gtg379u6nYZJFL30W50OV0F0qlf8OtkAlNpfOVOg3sJf9zklARE2lVY9g2Y9sv/iQ3g==", "dependencies": { "@nextcloud/auth": "^2.2.1", "@nextcloud/l10n": "^2.2.0", @@ -3928,7 +3928,7 @@ "@nextcloud/paths": "^2.1.0", "@nextcloud/router": "^2.2.0", "is-svg": "^5.0.0", - "webdav": "^5.3.0" + "webdav": "^5.3.1" }, "engines": { "node": "^20.0.0", diff --git a/package.json b/package.json index 7483be51486..c06bb1907c8 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "@nextcloud/capabilities": "^1.0.4", "@nextcloud/dialogs": "^5.0.3", "@nextcloud/event-bus": "^3.1.0", - "@nextcloud/files": "^3.0.0", + "@nextcloud/files": "^3.1.0", "@nextcloud/initial-state": "^2.0.0", "@nextcloud/l10n": "^2.1.0", "@nextcloud/logger": "^2.5.0", |