refactor(files_sharing): Make file structure more clear

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
pull/45652/head
Ferdinand Thiessen 2024-06-28 15:37:18 +07:00
parent f0a765ee46
commit 563f8e7c5d
No known key found for this signature in database
GPG Key ID: 45FAE7268762B400
20 changed files with 31 additions and 27 deletions

@ -9,7 +9,8 @@ import { File, Permission, View, FileAction } from '@nextcloud/files'
import { ShareType } from '@nextcloud/sharing'
import * as eventBus from '@nextcloud/event-bus'
import axios from '@nextcloud/axios'
import '../main'
import '../main.ts'
vi.mock('@nextcloud/axios')

@ -11,7 +11,7 @@ import { translatePlural as n } from '@nextcloud/l10n'
import axios from '@nextcloud/axios'
import CheckSvg from '@mdi/svg/svg/check.svg?raw'
import { pendingSharesViewId } from '../views/shares'
import { pendingSharesViewId } from '../files_views/shares'
export const action = new FileAction({
id: 'accept-share',

@ -4,10 +4,10 @@
*/
import { File, Permission, View, DefaultType, FileAction } from '@nextcloud/files'
import { describe, expect, test, vi } from 'vitest'
import { deletedSharesViewId, pendingSharesViewId, sharedWithOthersViewId, sharedWithYouViewId, sharesViewId, sharingByLinksViewId } from '../files_views/shares'
import { action } from './openInFilesAction'
import '../main'
import { action } from './openInFilesAction'
import { deletedSharesViewId, pendingSharesViewId, sharedWithOthersViewId, sharedWithYouViewId, sharesViewId, sharingByLinksViewId } from '../views/shares'
const view = {
id: 'files',

@ -7,7 +7,7 @@ import type { Node } from '@nextcloud/files'
import { registerFileAction, FileAction, DefaultType, FileType } from '@nextcloud/files'
import { translate as t } from '@nextcloud/l10n'
import { sharesViewId, sharedWithYouViewId, sharedWithOthersViewId, sharingByLinksViewId } from '../views/shares'
import { sharesViewId, sharedWithYouViewId, sharedWithOthersViewId, sharingByLinksViewId } from '../files_views/shares'
export const action = new FileAction({
id: 'open-in-files',

@ -9,11 +9,11 @@ import { generateOcsUrl } from '@nextcloud/router'
import { registerFileAction, FileAction } from '@nextcloud/files'
import { translatePlural as n } from '@nextcloud/l10n'
import { ShareType } from '@nextcloud/sharing'
import { pendingSharesViewId } from '../files_views/shares'
import axios from '@nextcloud/axios'
import CloseSvg from '@mdi/svg/svg/close.svg?raw'
import { pendingSharesViewId } from '../views/shares'
export const action = new FileAction({
id: 'reject-share',
displayName: (nodes: Node[]) => n('files_sharing', 'Reject share', 'Reject shares', nodes.length),

@ -9,7 +9,7 @@ import { beforeAll, beforeEach, describe, expect, test, vi } from 'vitest'
import axios from '@nextcloud/axios'
import * as eventBus from '@nextcloud/event-bus'
import { action } from './restoreShareAction'
import '../main'
import '../main.ts'
vi.mock('@nextcloud/auth')
vi.mock('@nextcloud/axios')

@ -11,7 +11,7 @@ import { translatePlural as n } from '@nextcloud/l10n'
import ArrowULeftTopSvg from '@mdi/svg/svg/arrow-u-left-top.svg?raw'
import axios from '@nextcloud/axios'
import { deletedSharesViewId } from '../views/shares'
import { deletedSharesViewId } from '../files_views/shares'
export const action = new FileAction({
id: 'restore-share',

@ -6,7 +6,7 @@
.action-items > .files-list__row-action-sharing-status {
// put icon at the end of the button
direction: rtl;
// align icons with textless inline actions
// align icons with text-less inline actions
padding-inline-end: 0 !important;
}

@ -23,7 +23,9 @@ export default function registerNoteToRecipient() {
enabled: (folder: Folder) => Boolean(folder.attributes.note),
// Update the root folder if needed
updated: (folder: Folder) => {
instance.updateFolder(folder)
if (instance) {
instance.updateFolder(folder)
}
},
// render simply spawns the component
render: async (el: HTMLElement, folder: Folder) => {

@ -10,6 +10,7 @@ import { translate as t } from '@nextcloud/l10n'
import FileUploadSvg from '@mdi/svg/svg/file-upload.svg?raw'
import Config from '../services/ConfigService'
import { isPublicShare } from '@nextcloud/sharing/public'
const sharingConfig = new Config()
const NewFileRequestDialogVue = defineAsyncComponent(() => import('../components/NewFileRequestDialog.vue'))
@ -22,6 +23,10 @@ export const entry = {
iconSvgInline: FileUploadSvg,
order: 10,
enabled(): boolean {
// not on public shares
if (isPublicShare()) {
return false
}
// We will check for the folder permission on the dialog
return sharingConfig.isPublicShareAllowed
},

@ -2,11 +2,11 @@
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { getNavigation, registerDavProperty } from '@nextcloud/files'
import { getNavigation } from '@nextcloud/files'
import { loadState } from '@nextcloud/initial-state'
import registerFileDropView from './views/publicFileDrop.ts'
import registerPublicShareView from './views/publicShare.ts'
import registerPublicFileShareView from './views/publicFileShare.ts'
import registerFileDropView from './files_views/publicFileDrop.ts'
import registerPublicShareView from './files_views/publicShare.ts'
import registerPublicFileShareView from './files_views/publicFileShare.ts'
import RouterService from '../../files/src/services/RouterService'
import router from './router'
@ -14,10 +14,6 @@ registerFileDropView()
registerPublicShareView()
registerPublicFileShareView()
registerDavProperty('nc:share-attributes', { nc: 'http://nextcloud.org/ns' })
registerDavProperty('oc:share-types', { oc: 'http://owncloud.org/ns' })
registerDavProperty('ocs:share-permissions', { ocs: 'http://open-collaboration-services.org/ns' })
// Get the current view from state and set it active
const view = loadState<string>('files_sharing', 'view')
const navigation = getNavigation()

@ -3,17 +3,17 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { addNewFileMenuEntry, registerDavProperty } from '@nextcloud/files'
import { registerAccountFilter } from './filters/AccountFilter'
import { entry as newFileRequest } from './new/newFileRequest.ts'
import { registerAccountFilter } from './files_filters/AccountFilter'
import { entry as newFileRequest } from './files_newMenu/newFileRequest'
import registerNoteToRecipient from './files_headers/noteToRecipient'
import registerSharingViews from './views/shares'
import registerSharingViews from './files_views/shares'
import './actions/acceptShareAction'
import './actions/openInFilesAction'
import './actions/rejectShareAction'
import './actions/restoreShareAction'
import './actions/sharingStatusAction'
import './files_actions/acceptShareAction'
import './files_actions/openInFilesAction'
import './files_actions/rejectShareAction'
import './files_actions/restoreShareAction'
import './files_actions/sharingStatusAction'
registerSharingViews()