Browse Source

chore(deps): bump `@nextcloud/files` to `3.1.0`

Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
John Molakvoæ 5 months ago
parent
commit
8481393581

+ 8 - 4
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')
 	})
 })

+ 2 - 8
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) {

+ 1 - 1
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

+ 5 - 5
package-lock.json

@@ -19,7 +19,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",
@@ -3998,9 +3998,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",
@@ -4008,7 +4008,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",

+ 1 - 1
package.json

@@ -46,7 +46,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",