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

[stable31] chore(deps): bump webdav from 5.7.1 to 5.8.0 #51186

Merged
merged 3 commits into from
Mar 2, 2025
Merged
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
10 changes: 6 additions & 4 deletions apps/systemtags/src/files_actions/bulkSystemTagsAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ import { loadState } from '@nextcloud/initial-state'

import TagMultipleSvg from '@mdi/svg/svg/tag-multiple.svg?raw'

const restrictSystemTagsCreationToAdmin = loadState<'0'|'1'>('settings', 'restrictSystemTagsCreationToAdmin', '0') === '1'

/**
*
* @param nodes
* Spawn a dialog to add or remove tags from multiple nodes.
* @param nodes Nodes to modify tags for
*/
async function execBatch(nodes: Node[]): Promise<(null|boolean)[]> {
const response = await new Promise<null|boolean>((resolve) => {
Expand All @@ -37,7 +39,7 @@ export const action = new FileAction({
// If the app is disabled, the action is not available anyway
enabled(nodes) {
// By default, everyone can create system tags
if (loadState('settings', 'restrictSystemTagsCreationToAdmin', '0') === '1' && getCurrentUser()?.isAdmin !== true) {
if (restrictSystemTagsCreationToAdmin && getCurrentUser()?.isAdmin !== true) {
return false
}

Expand All @@ -50,7 +52,7 @@ export const action = new FileAction({
}

// Disabled for non dav resources
if (nodes.some((node) => !node.isDavRessource)) {
if (nodes.some((node) => !node.isDavResource)) {
return false
}

Expand Down
93 changes: 91 additions & 2 deletions apps/systemtags/src/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@

import type { DAVResultResponseProps } from 'webdav'
import type { ServerTag, Tag } from './types.js'
import { describe, expect, it } from 'vitest'

import { formatTag, parseIdFromLocation, parseTags } from './utils'
import { describe, expect, it } from 'vitest'
import { formatTag, getNodeSystemTags, parseIdFromLocation, parseTags } from './utils'
import { Folder } from '@nextcloud/files'

describe('systemtags - utils', () => {
describe('parseTags', () => {
Expand Down Expand Up @@ -85,4 +86,92 @@ describe('systemtags - utils', () => {
})
})
})

describe('getNodeSystemTags', () => {
it('parses a plain tag', () => {
const node = new Folder({
owner: 'test',
source: 'https://example.com/remote.php/dav/files/test/folder',
attributes: {
'system-tags': {
'system-tag': 'tag',
},
},
})
expect(getNodeSystemTags(node)).toStrictEqual(['tag'])
})

it('parses plain tags', () => {
const node = new Folder({
owner: 'test',
source: 'https://example.com/remote.php/dav/files/test/folder',
attributes: {
'system-tags': {
'system-tag': [
'tag',
'my-tag',
],
},
},
})
expect(getNodeSystemTags(node)).toStrictEqual(['tag', 'my-tag'])
})

it('parses tag with attributes', () => {
const node = new Folder({
owner: 'test',
source: 'https://example.com/remote.php/dav/files/test/folder',
attributes: {
'system-tags': {
'system-tag': {
text: 'tag',
'@can-assign': true,
},
},
},
})
expect(getNodeSystemTags(node)).toStrictEqual(['tag'])
})

it('parses tags with attributes', () => {
const node = new Folder({
owner: 'test',
source: 'https://example.com/remote.php/dav/files/test/folder',
attributes: {
'system-tags': {
'system-tag': [
{
text: 'tag',
'@can-assign': true,
},
{
text: 'my-tag',
'@can-assign': false,
},
],
},
},
})
expect(getNodeSystemTags(node)).toStrictEqual(['tag', 'my-tag'])
})

it('parses tags mixed with and without attributes', () => {
const node = new Folder({
owner: 'test',
source: 'https://example.com/remote.php/dav/files/test/folder',
attributes: {
'system-tags': {
'system-tag': [
'tag',
{
text: 'my-tag',
'@can-assign': false,
},
],
},
},
})
expect(getNodeSystemTags(node)).toStrictEqual(['tag', 'my-tag'])
})
})
})
17 changes: 13 additions & 4 deletions apps/systemtags/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,22 @@ export const formatTag = (initialTag: Tag | ServerTag): ServerTag => {
}

export const getNodeSystemTags = function(node: Node): string[] {
const tags = node.attributes?.['system-tags']?.['system-tag'] as string|string[]|undefined

if (tags === undefined) {
const attribute = node.attributes?.['system-tags']?.['system-tag']
if (attribute === undefined) {
return []
}

return [tags].flat()
// if there is only one tag it is a single string or prop object
// if there are multiple then its an array - so we flatten it to be always an array of string or prop objects
return [attribute]
.flat()
.map((tag: string|{ text: string }) => (
typeof tag === 'string'
// its a plain text prop (the tag name) without prop attributes
? tag
// its a prop object with attributes, the tag name is in the 'text' attribute
: tag.text
))
}

export const setNodeSystemTags = function(node: Node, tags: string[]): void {
Expand Down
6 changes: 3 additions & 3 deletions dist/3920-3920.js.license
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ This file is generated from multiple sources. Included packages:
- version: 3.3.0
- license: MIT
- fast-xml-parser
- version: 4.4.1
- version: 4.5.3
- license: MIT
- floating-vue
- version: 1.0.0-beta.19
Expand Down Expand Up @@ -318,7 +318,7 @@ This file is generated from multiple sources. Included packages:
- version: 3.2.0
- license: MIT
- strnum
- version: 1.0.5
- version: 1.1.2
- license: MIT
- style-loader
- version: 4.0.0
Expand Down Expand Up @@ -366,7 +366,7 @@ This file is generated from multiple sources. Included packages:
- version: 2.7.16
- license: MIT
- webdav
- version: 5.7.1
- version: 5.8.0
- license: MIT
- which-typed-array
- version: 1.1.15
Expand Down
6 changes: 3 additions & 3 deletions dist/5531-5531.js.license
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ This file is generated from multiple sources. Included packages:
- version: 3.3.0
- license: MIT
- fast-xml-parser
- version: 4.4.1
- version: 4.5.3
- license: MIT
- floating-vue
- version: 1.0.0-beta.19
Expand Down Expand Up @@ -326,7 +326,7 @@ This file is generated from multiple sources. Included packages:
- version: 1.3.0
- license: MIT
- strnum
- version: 1.0.5
- version: 1.1.2
- license: MIT
- style-loader
- version: 4.0.0
Expand Down Expand Up @@ -365,7 +365,7 @@ This file is generated from multiple sources. Included packages:
- version: 2.7.16
- license: MIT
- webdav
- version: 5.7.1
- version: 5.8.0
- license: MIT
- which-typed-array
- version: 1.1.15
Expand Down
6 changes: 3 additions & 3 deletions dist/7462-7462.js.license
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ This file is generated from multiple sources. Included packages:
- version: 3.3.0
- license: MIT
- fast-xml-parser
- version: 4.4.1
- version: 4.5.3
- license: MIT
- floating-vue
- version: 1.0.0-beta.19
Expand Down Expand Up @@ -318,7 +318,7 @@ This file is generated from multiple sources. Included packages:
- version: 3.2.0
- license: MIT
- strnum
- version: 1.0.5
- version: 1.1.2
- license: MIT
- style-loader
- version: 4.0.0
Expand Down Expand Up @@ -366,7 +366,7 @@ This file is generated from multiple sources. Included packages:
- version: 2.7.16
- license: MIT
- webdav
- version: 5.7.1
- version: 5.8.0
- license: MIT
- which-typed-array
- version: 1.1.15
Expand Down
6 changes: 3 additions & 3 deletions dist/8057-8057.js.license
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ This file is generated from multiple sources. Included packages:
- version: 3.3.0
- license: MIT
- fast-xml-parser
- version: 4.4.1
- version: 4.5.3
- license: MIT
- floating-vue
- version: 1.0.0-beta.19
Expand Down Expand Up @@ -318,7 +318,7 @@ This file is generated from multiple sources. Included packages:
- version: 3.2.0
- license: MIT
- strnum
- version: 1.0.5
- version: 1.1.2
- license: MIT
- style-loader
- version: 4.0.0
Expand Down Expand Up @@ -366,7 +366,7 @@ This file is generated from multiple sources. Included packages:
- version: 2.7.16
- license: MIT
- webdav
- version: 5.7.1
- version: 5.8.0
- license: MIT
- which-typed-array
- version: 1.1.15
Expand Down
6 changes: 3 additions & 3 deletions dist/comments-comments-app.js.license
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ This file is generated from multiple sources. Included packages:
- version: 3.3.0
- license: MIT
- fast-xml-parser
- version: 4.4.1
- version: 4.5.3
- license: MIT
- floating-vue
- version: 1.0.0-beta.19
Expand Down Expand Up @@ -318,7 +318,7 @@ This file is generated from multiple sources. Included packages:
- version: 3.2.0
- license: MIT
- strnum
- version: 1.0.5
- version: 1.1.2
- license: MIT
- style-loader
- version: 4.0.0
Expand Down Expand Up @@ -366,7 +366,7 @@ This file is generated from multiple sources. Included packages:
- version: 2.7.16
- license: MIT
- webdav
- version: 5.7.1
- version: 5.8.0
- license: MIT
- webpack
- version: 5.94.0
Expand Down
6 changes: 3 additions & 3 deletions dist/comments-comments-tab.js.license
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ This file is generated from multiple sources. Included packages:
- version: 3.3.0
- license: MIT
- fast-xml-parser
- version: 4.4.1
- version: 4.5.3
- license: MIT
- for-each
- version: 0.3.3
Expand Down Expand Up @@ -267,7 +267,7 @@ This file is generated from multiple sources. Included packages:
- version: 1.3.0
- license: MIT
- strnum
- version: 1.0.5
- version: 1.1.2
- license: MIT
- url-join
- version: 5.0.0
Expand All @@ -288,7 +288,7 @@ This file is generated from multiple sources. Included packages:
- version: 2.7.16
- license: MIT
- webdav
- version: 5.7.1
- version: 5.8.0
- license: MIT
- webpack
- version: 5.94.0
Expand Down
4 changes: 2 additions & 2 deletions dist/core-common.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/core-common.js.license
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ This file is generated from multiple sources. Included packages:
- version: 3.0.2
- license: MIT
- fast-xml-parser
- version: 4.4.1
- version: 4.5.3
- license: MIT
- filter-obj
- version: 5.1.0
Expand Down Expand Up @@ -669,7 +669,7 @@ This file is generated from multiple sources. Included packages:
- version: 3.2.0
- license: MIT
- strnum
- version: 1.0.5
- version: 1.1.2
- license: MIT
- style-loader
- version: 4.0.0
Expand Down Expand Up @@ -762,7 +762,7 @@ This file is generated from multiple sources. Included packages:
- version: 2.0.1
- license: MIT
- webdav
- version: 5.7.1
- version: 5.8.0
- license: MIT
- which-typed-array
- version: 1.1.15
Expand Down
2 changes: 1 addition & 1 deletion dist/core-common.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/dav-settings-personal-availability.js.license
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ This file is generated from multiple sources. Included packages:
- version: 3.3.0
- license: MIT
- fast-xml-parser
- version: 4.4.1
- version: 4.5.3
- license: MIT
- floating-vue
- version: 1.0.0-beta.19
Expand Down Expand Up @@ -345,7 +345,7 @@ This file is generated from multiple sources. Included packages:
- version: 3.2.0
- license: MIT
- strnum
- version: 1.0.5
- version: 1.1.2
- license: MIT
- style-loader
- version: 4.0.0
Expand Down Expand Up @@ -396,7 +396,7 @@ This file is generated from multiple sources. Included packages:
- version: 2.7.16
- license: MIT
- webdav
- version: 5.7.1
- version: 5.8.0
- license: MIT
- webpack
- version: 5.94.0
Expand Down
Loading
Loading