Skip to content

Commit

Permalink
Merge pull request #1417 from nextcloud/bugfix/noid/revision-restore
Browse files Browse the repository at this point in the history
[stable3.7] Fix version restore
  • Loading branch information
rullzer authored Mar 9, 2021
2 parents 2e7c41c + 6c7ad2c commit c9fcf27
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/view/FilesAppIntegration.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,14 +417,25 @@ export default {
avatardiv.append(popover)
},

_originalOnClickRevertVersion: null,

addVersionSidebarEvents() {
const versionTabView = OCA.Files.App.fileList._detailsView._tabViews.find(t => t.el.id === 'versionsTabView')
if (versionTabView) {
this._originalOnClickRevertVersion = versionTabView._onClickRevertVersion
OCA.Files.App.fileList._detailsView._tabViews.find(t => t.el.id === 'versionsTabView')._onClickRevertVersion = () => {}
}
$(document.querySelector('#content')).on('click.revisions', '#app-sidebar .preview-container', this.showVersionPreview.bind(this))
$(document.querySelector('#content')).on('click.revisions', '#app-sidebar .downloadVersion', this.showVersionPreview.bind(this))
$(document.querySelector('#content')).on('mousedown.revisions', '#app-sidebar .revertVersion', this.restoreVersion.bind(this))
$(document.querySelector('#content')).on('click.revisionsTab', '#app-sidebar [data-tabid=versionsTabView]', this.addCurrentVersion.bind(this))
},

removeVersionSidebarEvents() {
const versionTabView = OCA.Files.App.fileList._detailsView._tabViews.find(t => t.el.id === 'versionsTabView')
if (versionTabView) {
versionTabView._onClickRevertVersion = this._originalOnClickRevertVersion
}
$(document.querySelector('#content')).off('click.revisions')
$(document.querySelector('#content')).off('click.revisions')
$(document.querySelector('#content')).off('mousedown.revisions')
Expand Down

0 comments on commit c9fcf27

Please sign in to comment.