VersionEntry Download

This commit is contained in:
Terry 2021-05-10 15:10:52 +02:00
parent ab9efa09d4
commit cda48ad3f8
3 changed files with 12 additions and 20 deletions

View File

@ -41835,9 +41835,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
return this.fileInfo.id === this.version.basename;
},
versionUrl: function versionUrl() {
return Object(_nextcloud_router__WEBPACK_IMPORTED_MODULE_6__["generateUrl"])('/remote.php/dav/versions/{user}' + this.version.filename, {
user: Object(_nextcloud_auth__WEBPACK_IMPORTED_MODULE_7__["getCurrentUser"])().uid
});
return Object(_nextcloud_router__WEBPACK_IMPORTED_MODULE_6__["generateRemoteUrl"])("dav/versions/".concat(Object(_nextcloud_auth__WEBPACK_IMPORTED_MODULE_7__["getCurrentUser"])().uid) + this.version.filename);
},
iconUrl: function iconUrl() {
return OC.MimeType.getIconUrl(this.fileInfo.mimetype);
@ -41861,30 +41859,27 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
case 0:
_context.prev = 0;
_context.next = 3;
return Object(_services_DavClient__WEBPACK_IMPORTED_MODULE_8__["move"])('/remote.php/dav/versions/{user}' + _this.version.basename, {
user: Object(_nextcloud_auth__WEBPACK_IMPORTED_MODULE_7__["getCurrentUser"])().uid
}, '/restore/target', true);
return Object(_services_DavClient__WEBPACK_IMPORTED_MODULE_8__["move"])(Object(_nextcloud_router__WEBPACK_IMPORTED_MODULE_6__["generateRemoteUrl"])("dav/versions/".concat(Object(_nextcloud_auth__WEBPACK_IMPORTED_MODULE_7__["getCurrentUser"])().uid) + _this.version.filename, '/restore/target', true));
case 3:
revert = _context.sent;
_this.revert = revert;
_context.next = 11;
break;
return _context.abrupt("return", _this.revert);
case 7:
_context.prev = 7;
case 8:
_context.prev = 8;
_context.t0 = _context["catch"](0);
_this.error = t('files_versions', 'There was an error reverting the version {file}', {
file: _this.fileInfo.basename
});
Object(_nextcloud_dialogs__WEBPACK_IMPORTED_MODULE_9__["showError"])(_this.error);
case 11:
case 12:
case "end":
return _context.stop();
}
}
}, _callee, null, [[0, 7]]);
}, _callee, null, [[0, 8]]);
}))();
}
}

File diff suppressed because one or more lines are too long

View File

@ -47,7 +47,7 @@ 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 { generateUrl } from '@nextcloud/router'
import { generateRemoteUrl } from '@nextcloud/router'
import { getCurrentUser } from '@nextcloud/auth'
import { move } from '../services/DavClient'
import { showError } from '@nextcloud/dialogs'
@ -101,9 +101,7 @@ export default {
},
versionUrl() {
return generateUrl('/remote.php/dav/versions/{user}' + this.version.filename, {
user: getCurrentUser().uid,
})
return generateRemoteUrl(`dav/versions/${getCurrentUser().uid}` + this.version.filename)
},
iconUrl() {
return OC.MimeType.getIconUrl(this.fileInfo.mimetype)
@ -122,10 +120,9 @@ export default {
async restoreVersion() {
// TODO: implement restore request and loading
try {
const revert = await move('/remote.php/dav/versions/{user}' + this.version.basename, {
user: getCurrentUser().uid,
}, '/restore/target', true)
const revert = await move(generateRemoteUrl(`dav/versions/${getCurrentUser().uid}` + this.version.filename, '/restore/target', true))
this.revert = revert
return this.revert
} catch (error) {
this.error = t('files_versions', 'There was an error reverting the version {file}', {
file: this.fileInfo.basename,