mirror of
https://github.com/nextcloud/server.git
synced 2026-06-12 02:00:51 -04:00
chore(files): Provide old node on moved
Signed-off-by: Christopher Ng <chrng8@gmail.com>
This commit is contained in:
parent
26aa322e44
commit
fb87dc331b
2 changed files with 4 additions and 4 deletions
|
|
@ -46,7 +46,6 @@ import { showError, showSuccess } from '@nextcloud/dialogs'
|
|||
import { emit } from '@nextcloud/event-bus'
|
||||
import { FileType, NodeStatus } from '@nextcloud/files'
|
||||
import { translate as t } from '@nextcloud/l10n'
|
||||
import { dirname } from '@nextcloud/paths'
|
||||
import { defineComponent, inject } from 'vue'
|
||||
|
||||
import NcTextField from '@nextcloud/vue/dist/Components/NcTextField.js'
|
||||
|
|
@ -244,6 +243,7 @@ export default defineComponent({
|
|||
return
|
||||
}
|
||||
|
||||
const oldNode = this.source.clone()
|
||||
const oldName = this.source.basename
|
||||
const oldEncodedSource = this.source.encodedSource
|
||||
if (oldName === newName) {
|
||||
|
|
@ -272,8 +272,8 @@ export default defineComponent({
|
|||
emit('files:node:updated', this.source)
|
||||
emit('files:node:renamed', this.source)
|
||||
emit('files:node:moved', {
|
||||
node: this.source,
|
||||
oldSource: `${dirname(this.source.source)}/${oldName}`,
|
||||
newNode: this.source,
|
||||
oldNode,
|
||||
})
|
||||
showSuccess(t('files', 'Renamed "{oldName}" to "{newName}"', { oldName, newName }))
|
||||
|
||||
|
|
|
|||
2
apps/files/src/eventbus.d.ts
vendored
2
apps/files/src/eventbus.d.ts
vendored
|
|
@ -16,7 +16,7 @@ declare module '@nextcloud/event-bus' {
|
|||
'files:node:deleted': Node
|
||||
'files:node:updated': Node
|
||||
'files:node:renamed': Node
|
||||
'files:node:moved': { node: Node, oldSource: string }
|
||||
'files:node:moved': { newNode: Node, oldNode: Node }
|
||||
|
||||
'files:filter:added': IFileListFilter
|
||||
'files:filter:removed': string
|
||||
|
|
|
|||
Loading…
Reference in a new issue