diff options
Diffstat (limited to 'apps/files_sharing/src/utils/NodeShareUtils.ts')
-rw-r--r-- | apps/files_sharing/src/utils/NodeShareUtils.ts | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/apps/files_sharing/src/utils/NodeShareUtils.ts b/apps/files_sharing/src/utils/NodeShareUtils.ts index f81e18796ed..f14f981e2ad 100644 --- a/apps/files_sharing/src/utils/NodeShareUtils.ts +++ b/apps/files_sharing/src/utils/NodeShareUtils.ts @@ -1,28 +1,11 @@ /** - * @copyright Copyright (c) 2024 John Molakvoæ <skjnldsv@protonmail.com> - * - * @author John Molakvoæ <skjnldsv@protonmail.com> - * - * @license AGPL-3.0-or-later - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ import { getCurrentUser } from '@nextcloud/auth' import type { Node } from '@nextcloud/files' -import { Type } from '@nextcloud/sharing' +import { ShareType } from '@nextcloud/sharing' type Share = { /** The recipient display name */ @@ -30,7 +13,7 @@ type Share = { /** The recipient user id */ id: string /** The share type */ - type: Type + type: ShareType } const getSharesAttribute = function(node: Node) { @@ -48,10 +31,10 @@ export const isNodeSharedWithMe = function(node: Node) { return shares.length > 0 && ( // If some shares are shared with you as a direct user share - shares.some(share => share.id === uid && share.type === Type.SHARE_TYPE_USER) + shares.some(share => share.id === uid && share.type === ShareType.User) // Or of the file is shared with a group you're in // (if it's returned by the backend, we assume you're in it) - || shares.some(share => share.type === Type.SHARE_TYPE_GROUP) + || shares.some(share => share.type === ShareType.Group) ) } @@ -66,7 +49,7 @@ export const isNodeSharedWithOthers = function(node: Node) { return shares.length > 0 // If some shares are shared with you as a direct user share - && shares.some(share => share.id !== uid && share.type !== Type.SHARE_TYPE_GROUP) + && shares.some(share => share.id !== uid && share.type !== ShareType.Group) } export const isNodeShared = function(node: Node) { |