Skip to content

Commit c9fd510

Browse files
committed
chore(deps): bump @nextcloud/files to 3.1.0
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
1 parent 561b0c0 commit c9fd510

File tree

5 files changed

+17
-19
lines changed

5 files changed

+17
-19
lines changed

apps/files/src/actions/deleteAction.spec.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ const trashbinView = {
3838
} as View
3939

4040
describe('Delete action conditions tests', () => {
41+
afterEach(() => {
42+
jest.restoreAllMocks()
43+
})
44+
4145
const file = new File({
4246
id: 1,
4347
source: 'https://cloud.domain.com/remote.php/dav/files/test/foobar.txt',
@@ -48,8 +52,8 @@ describe('Delete action conditions tests', () => {
4852

4953
const file2 = new File({
5054
id: 1,
51-
source: 'https://cloud.domain.com/remote.php/dav/files/test/foobar.txt',
52-
owner: 'user2',
55+
source: 'https://cloud.domain.com/remote.php/dav/files/admin/foobar.txt',
56+
owner: 'admin',
5357
mime: 'text/plain',
5458
permissions: Permission.ALL,
5559
})
@@ -67,12 +71,12 @@ describe('Delete action conditions tests', () => {
6771
expect(action.displayName([file], trashbinView)).toBe('Delete permanently')
6872
})
6973

70-
test('Shared node view values', () => {
74+
test('Shared node values', () => {
7175
jest.spyOn(auth, 'getCurrentUser').mockReturnValue(null)
7276
expect(action.displayName([file2], view)).toBe('Unshare')
7377
})
7478

75-
test('Shared and owned nodes view values', () => {
79+
test('Shared and owned nodes values', () => {
7680
expect(action.displayName([file, file2], view)).toBe('Delete and unshare')
7781
})
7882
})

apps/files/src/actions/deleteAction.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,10 @@ import CloseSvg from '@mdi/svg/svg/close.svg?raw'
2929
import logger from '../logger.js'
3030
import { getCurrentUser } from '@nextcloud/auth'
3131

32-
// A file which the owner is NOT the current user
33-
// is considered shared. Other methods like group folders
34-
// will always use the current user as the owner.
35-
// It will therefore not be considered shared.
3632
const isAllUnshare = (nodes: Node[]) => {
37-
return !nodes.some(node => node.owner !== getCurrentUser()?.uid)
33+
return !nodes.some(node => node.owner === getCurrentUser()?.uid)
3834
}
3935

40-
// Check whether the selection contains a mix of files
41-
// the current user owns and files owned by other users.
4236
const isMixedUnshareAndDelete = (nodes: Node[]) => {
4337
const hasUnshareItems = nodes.some(node => node.owner !== getCurrentUser()?.uid)
4438
const hasDeleteItems = nodes.some(node => node.owner === getCurrentUser()?.uid)
@@ -79,7 +73,7 @@ export const action = new FileAction({
7973

8074
// Let's delete even if it's moved to the trashbin
8175
// since it has been removed from the current view
82-
// and changing the view will trigger a reload anyway.
76+
// and changing the view will trigger a reload anyway.
8377
emit('files:node:deleted', node)
8478
return true
8579
} catch (error) {

apps/files/src/services/Files.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ interface ResponseProps extends DAVResultResponseProps {
4242
export const resultToNode = function(node: FileStat): File | Folder {
4343
const props = node.props as ResponseProps
4444
const permissions = davParsePermissions(props?.permissions)
45-
const owner = getCurrentUser()?.uid as string
45+
const owner = (props['owner-id'] || getCurrentUser()?.uid) as string
4646

4747
const source = generateRemoteUrl('dav' + rootPath + node.filename)
4848
const id = props?.fileid < 0

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"@nextcloud/capabilities": "^1.0.4",
4848
"@nextcloud/dialogs": "^5.0.3",
4949
"@nextcloud/event-bus": "^3.1.0",
50-
"@nextcloud/files": "^3.0.0",
50+
"@nextcloud/files": "^3.1.0",
5151
"@nextcloud/initial-state": "^2.0.0",
5252
"@nextcloud/l10n": "^2.1.0",
5353
"@nextcloud/logger": "^2.5.0",

0 commit comments

Comments
 (0)