mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
Merge pull request #54410 from nextcloud/fix/sharing-status-action-sidebar-promise-return
This commit is contained in:
commit
d5417d63e0
7 changed files with 54 additions and 16 deletions
|
|
@ -2,7 +2,6 @@
|
|||
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
import type { Pinia } from 'pinia'
|
||||
import { getCSPNonce } from '@nextcloud/auth'
|
||||
import { PiniaVuePlugin } from 'pinia'
|
||||
import Vue from 'vue'
|
||||
|
|
@ -16,16 +15,6 @@ import SettingsService from './services/Settings.js'
|
|||
|
||||
__webpack_nonce__ = getCSPNonce()
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
OC: Nextcloud.v29.OC
|
||||
OCP: Nextcloud.v29.OCP
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
OCA: Record<string, any>
|
||||
_nc_files_pinia: Pinia
|
||||
}
|
||||
}
|
||||
|
||||
// Init private and public Files namespace
|
||||
window.OCA.Files = window.OCA.Files ?? {}
|
||||
window.OCP.Files = window.OCP.Files ?? {}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import { action as sidebarAction } from '../../../files/src/actions/sidebarActio
|
|||
import { generateAvatarSvg } from '../utils/AccountIcon'
|
||||
|
||||
import './sharingStatusAction.scss'
|
||||
import { showError } from '@nextcloud/dialogs'
|
||||
|
||||
const isExternal = (node: Node) => {
|
||||
return node.attributes?.['is-federated'] ?? false
|
||||
|
|
@ -125,15 +126,23 @@ export const action = new FileAction({
|
|||
return true
|
||||
}
|
||||
|
||||
// You need share permissions to share this file
|
||||
// and read permissions to see the sidebar
|
||||
return (node.permissions & Permission.SHARE) !== 0
|
||||
&& (node.permissions & Permission.READ) !== 0
|
||||
},
|
||||
|
||||
async exec(node: Node, view: View, dir: string) {
|
||||
// You need read permissions to see the sidebar
|
||||
if ((node.permissions & Permission.READ) !== 0) {
|
||||
window.OCA?.Files?.Sidebar?.setActiveTab?.('sharing')
|
||||
return sidebarAction.exec(node, view, dir)
|
||||
sidebarAction.exec(node, view, dir)
|
||||
return null
|
||||
}
|
||||
|
||||
// Should not happen as the enabled check should prevent this
|
||||
// leaving it here for safety or in case someone calls this action directly
|
||||
showError(t('files_sharing', 'You do not have enough permissions to share this file.'))
|
||||
return null
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ $expectedFiles = [
|
|||
'webpack.common.js',
|
||||
'webpack.config.js',
|
||||
'webpack.modules.js',
|
||||
'window.d.ts',
|
||||
];
|
||||
$actualFiles = [];
|
||||
|
||||
|
|
|
|||
2
dist/files-main.js.map
vendored
2
dist/files-main.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/files_sharing-init.js
vendored
4
dist/files_sharing-init.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files_sharing-init.js.map
vendored
2
dist/files_sharing-init.js.map
vendored
File diff suppressed because one or more lines are too long
39
window.d.ts
vendored
Normal file
39
window.d.ts
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/**
|
||||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import type RouterService from './apps/files/src/services/RouterService'
|
||||
import type Settings from './apps/files/src/services/Settings'
|
||||
import type Sidebar from './apps/files/src/services/Sidebar'
|
||||
|
||||
type SidebarAPI = Sidebar & {
|
||||
open: (path: string) => Promise<void>
|
||||
close: () => void
|
||||
setFullScreenMode: (fullScreen: boolean) => void
|
||||
setShowTagsDefault: (showTagsDefault: boolean) => void
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
OC: Nextcloud.v29.OC
|
||||
|
||||
// Private Files namespace
|
||||
OCA: {
|
||||
Files: {
|
||||
Settings: Settings
|
||||
Sidebar: SidebarAPI
|
||||
}
|
||||
} & Record<string, any> // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
|
||||
// Public Files namespace
|
||||
OCP: {
|
||||
Files: {
|
||||
Router: RouterService
|
||||
}
|
||||
} & Nextcloud.v29.OCP
|
||||
|
||||
// Private global files pinia store
|
||||
_nc_files_pinia: Pinia
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue