Verion Revert

This commit is contained in:
Terry 2021-05-28 11:16:48 +02:00
parent 4a7222ce16
commit c1b56e93e8
3 changed files with 82 additions and 4178 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -47,13 +47,9 @@ import ActionButton from '@nextcloud/vue/dist/Components/ActionButton'
import ActionLink from '@nextcloud/vue/dist/Components/ActionLink'
import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip'
import ListItemIcon from '@nextcloud/vue/dist/Components/ListItemIcon'
import { generateOcsUrl, generateRemoteUrl } from '@nextcloud/router'
import { generateUrl, generateRemoteUrl } from '@nextcloud/router'
import { getCurrentUser } from '@nextcloud/auth'
import { move } from '../../../files/js/filelist'
import { showError } from '@nextcloud/dialogs'
import { moveFile } from '../services/DavClient'
export default {
name: 'VersionEntry',
@ -122,13 +118,20 @@ export default {
},
methods: {
async update(fileInfo) {
this.fileInfo = fileInfo
},
restoreVersion() {
try {
const currentPath = generateRemoteUrl(`dav/versions/${getCurrentUser().uid}` + this.version.filename)
const destinationPath = generateUrl('apps/files_sharing/api/v1', 2) + 'shares'
return moveFile(currentPath, destinationPath, '/restore/target', true)
return OC.Files.getClient.move(currentPath, destinationPath, '/restore/target', true)
} catch (error) {
this.error = t('files_versions', 'There was an error reverting the version {this.fileInfo.filename}')
this.error = t('files_versions', 'There was an error fetching the list of versions for the file {file}', {
file: this.fileInfo.basename,
})
showError(this.error)
}
},