Skip to content

Commit c8ae619

Browse files
authored
Merge pull request #60541 from nextcloud/fix/use-displayname
fix(files): use displayname rather than basename to use progress
2 parents 5508414 + 3337060 commit c8ae619

5 files changed

Lines changed: 16 additions & 12 deletions

File tree

apps/files/src/actions/moveOrCopyAction.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import { FilePickerClosed, getFilePickerBuilder, openConflictPicker, showError,
1414
import { emit } from '@nextcloud/event-bus'
1515
import { FileType, getUniqueName, NodeStatus, Permission } from '@nextcloud/files'
1616
import { defaultRootPath, getClient, getDefaultPropfind, resultToNode } from '@nextcloud/files/dav'
17-
import { t } from '@nextcloud/l10n'
17+
import { n, t } from '@nextcloud/l10n'
18+
import { basename, join } from '@nextcloud/paths'
1819
import { getConflicts } from '@nextcloud/upload'
19-
import { basename, join } from 'path'
2020
import Vue from 'vue'
2121
import { getContents } from '../services/Files.ts'
2222
import { logger } from '../utils/logger.ts'
@@ -156,7 +156,11 @@ export async function* handleCopyMoveNodesTo(nodes: INode[], destination: IFolde
156156
}
157157
}
158158

159-
const actionFinished = createLoadingNotification(method, nodes.map((node) => node.basename), destination.path)
159+
const actionFinished = createLoadingNotification(
160+
method,
161+
nodes.map((node) => node.displayname),
162+
join(destination.dirname, destination.displayname),
163+
)
160164
const queue = getQueue()
161165
try {
162166
for (const node of nodes) {
@@ -246,11 +250,11 @@ function createLoadingNotification(mode: MoveCopyAction, sources: string[], dest
246250
const text = mode === MoveCopyAction.MOVE
247251
? (sources.length === 1
248252
? t('files', 'Moving "{source}" to "{destination}" …', { source: sources[0]!, destination })
249-
: t('files', 'Moving {count} files to "{destination}" …', { count: sources.length, destination })
253+
: n('files', 'Moving %n file to "{destination}" …', 'Moving %n files to "{destination}" …', sources.length, { destination })
250254
)
251255
: (sources.length === 1
252256
? t('files', 'Copying "{source}" to "{destination}" …', { source: sources[0]!, destination })
253-
: t('files', 'Copying {count} files to "{destination}" …', { count: sources.length, destination })
257+
: n('files', 'Copying %n file to "{destination}" …', 'Copying %n files to "{destination}" …', sources.length, { destination })
254258
)
255259

256260
const toast = showLoading(text)
@@ -324,7 +328,7 @@ async function openFilePickerForAction(
324328

325329
if (action === MoveCopyAction.MOVE || action === MoveCopyAction.MOVE_OR_COPY) {
326330
buttons.push({
327-
label: target ? t('files', 'Move to {target}', { target }, undefined, { escape: false, sanitize: false }) : t('files', 'Move'),
331+
label: target ? t('files', 'Move to {target}', { target }, { escape: false, sanitize: false }) : t('files', 'Move'),
328332
variant: action === MoveCopyAction.MOVE ? 'primary' : 'secondary',
329333
icon: FolderMoveSvg,
330334
async callback(destination) {

dist/files-init.js

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

dist/files-init.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files-main.js

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

dist/files-main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)