Skip to content

Commit

Permalink
fix(systemtags): Correctly set the display name for the Nextcloud node
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>

Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>

[skip ci]
  • Loading branch information
susnux authored and backportbot[bot] committed Jul 31, 2024
1 parent 0d16ba6 commit 473f7fe
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions apps/systemtags/src/services/systemtags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import type { TagWithId } from '../types'
import { Folder, type ContentsWithRoot, Permission, getDavNameSpaces, getDavProperties } from '@nextcloud/files'
import { generateRemoteUrl } from '@nextcloud/router'
import { getCurrentUser } from '@nextcloud/auth'

import { Folder, Permission, getDavNameSpaces, getDavProperties, davGetClient, davResultToNode, davRemoteURL, davRootPath } from '@nextcloud/files'
import { fetchTags } from './api'
import { getClient } from '../../../files/src/services/WebdavClient'
import { resultToNode } from '../../../files/src/services/Files'
Expand All @@ -35,17 +35,18 @@ const formatReportPayload = (tagId: number) => `<?xml version="1.0"?>
<d:prop>
${getDavProperties()}
</d:prop>
<oc:filter-rules>
<oc:systemtag>${tagId}</oc:systemtag>
</oc:filter-rules>
<oc:filter-rules>
<oc:systemtag>${tagId}</oc:systemtag>
</oc:filter-rules>
</oc:filter-files>`

const tagToNode = function(tag: TagWithId): Folder {
return new Folder({
id: tag.id,
source: generateRemoteUrl('dav/systemtags/' + tag.id),
owner: getCurrentUser()?.uid as string,
root: '/systemtags',
source: `${davRemoteURL}${rootPath}/${tag.id}`,
owner: String(getCurrentUser()?.uid ?? 'anonymous'),
root: rootPath,
displayname: tag.displayName,
permissions: Permission.READ,
attributes: {
...tag,
Expand All @@ -62,16 +63,16 @@ export const getContents = async (path = '/'): Promise<ContentsWithRoot> => {
return {
folder: new Folder({
id: 0,
source: generateRemoteUrl('dav/systemtags'),
source: `${davRemoteURL}${rootPath}`,
owner: getCurrentUser()?.uid as string,
root: '/systemtags',
root: rootPath,
permissions: Permission.NONE,
}),
contents: tagsCache.map(tagToNode),
}
}

const tagId = parseInt(path.replace('/', ''), 10)
const tagId = parseInt(path.split('/', 2)[0])
const tag = tagsCache.find(tag => tag.id === tagId)

if (!tag) {
Expand Down

0 comments on commit 473f7fe

Please sign in to comment.