Skip to content

Commit da0d04d

Browse files
authored
Merge pull request #5300 from nextcloud/backport/5294/stable33
[stable33] fix: Properly handle sidebar in 33
2 parents 245535c + 657bc07 commit da0d04d

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

src/view/FilesAppIntegration.js

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import { isPublicShare } from '@nextcloud/sharing/public'
1010
import axios from '@nextcloud/axios'
1111
import { emit } from '@nextcloud/event-bus'
1212
import { getCurrentDirectory } from '../helpers/filesApp.js'
13+
import {
14+
getSidebar
15+
} from '@nextcloud/files'
1316
import {
1417
getClient,
1518
getDefaultPropfind,
@@ -106,7 +109,7 @@ export default {
106109

107110
this.changeFilesRoute(node.fileid)
108111

109-
OCA?.Files?.Sidebar?.close()
112+
getSidebar()?.close()
110113

111114
if (this.getFileList()) {
112115
const newFileModel = oldFile.clone()
@@ -115,12 +118,10 @@ export default {
115118
newFileModel.set('mtime', Date.now())
116119
this.getFileList()
117120
.add(newFileModel.toJSON())
118-
119-
OC.Apps.hideAppSidebar()
120121
}
121122
},
122123

123-
share() {
124+
async share() {
124125
if (this.handlers.share && this.handlers.share(this)) {
125126
return
126127
}
@@ -130,8 +131,10 @@ export default {
130131
return
131132
}
132133

133-
OCA?.Files?.Sidebar?.open(this.filePath + '/' + this.fileName)
134-
OCA?.Files?.Sidebar?.setActiveTab('sharing')
134+
const node = await this.getFileNode()
135+
const sidebar = getSidebar()
136+
sidebar?.open(node)
137+
sidebar?.setActiveTab('sharing')
135138
},
136139

137140
rename(newName) {
@@ -144,7 +147,7 @@ export default {
144147
}
145148

146149
if (this.getFileList()) {
147-
OC.Apps.hideAppSidebar()
150+
getSidebar()?.close()
148151
}
149152
},
150153

@@ -421,17 +424,20 @@ export default {
421424
avatardiv.append(popover)
422425
},
423426

424-
showRevHistory() {
427+
async showRevHistory() {
425428
if (this.handlers.showRevHistory && this.handlers.showRevHistory(this)) {
426429
return
427430
}
428431

429-
if (isPublicShare() || !OCA?.Files?.Sidebar) {
432+
if (isPublicShare()) {
430433
console.error('[FilesAppIntegration] Versions are not supported')
431434
return
432435
}
433-
OCA?.Files?.Sidebar?.open(this.filePath + '/' + this.fileName)
434-
OCA?.Files?.Sidebar?.setActiveTab('files_versions')
436+
437+
const node = await this.getFileNode()
438+
const sidebar = getSidebar()
439+
sidebar?.open(node)
440+
sidebar?.setActiveTab('files_versions')
435441
},
436442

437443
/**

src/view/Office.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ import uiMention from '../mixins/uiMention.js'
123123
import version from '../mixins/version.js'
124124
import { getCurrentUser, getGuestNickname } from '@nextcloud/auth'
125125
import { shouldAskForGuestName } from '../helpers/guestName.js'
126+
import { getSidebar } from '@nextcloud/files'
126127
127128
const FRAME_DOCUMENT = 'FRAME_DOCUMENT'
128129
@@ -288,7 +289,7 @@ export default {
288289
},
289290
})
290291
291-
window.OCA?.Files?.Sidebar?.close()
292+
getSidebar()?.close()
292293
}
293294
this.postMessage.registerPostMessageHandler(this.postMessageHandler)
294295

0 commit comments

Comments
 (0)