From d6efc531f6999b90330ec62869261be97dbe823f Mon Sep 17 00:00:00 2001
From: nfebe <fenn25.fn@gmail.com>
Date: Mon, 18 Nov 2024 17:34:55 +0100
Subject: refactor: Use new `ShareType` across file_sharing

Signed-off-by: nfebe <fenn25.fn@gmail.com>
---
 apps/files_sharing/src/views/SharingDetailsTab.vue | 55 +++++++++++-----------
 1 file changed, 27 insertions(+), 28 deletions(-)

(limited to 'apps/files_sharing/src/views/SharingDetailsTab.vue')

diff --git a/apps/files_sharing/src/views/SharingDetailsTab.vue b/apps/files_sharing/src/views/SharingDetailsTab.vue
index 70f49dea83e..c0c07cdf50d 100644
--- a/apps/files_sharing/src/views/SharingDetailsTab.vue
+++ b/apps/files_sharing/src/views/SharingDetailsTab.vue
@@ -8,7 +8,7 @@
 			<span>
 				<NcAvatar v-if="isUserShare"
 					class="sharing-entry__avatar"
-					:is-no-user="share.shareType !== SHARE_TYPES.SHARE_TYPE_USER"
+					:is-no-user="share.shareType !== ShareType.User"
 					:user="share.shareWith"
 					:display-name="share.shareWithDisplayName"
 					:menu-position="'left'"
@@ -195,7 +195,7 @@
 							data-cy-files-sharing-share-permissions-checkbox="update">
 							{{ t('files_sharing', 'Edit') }}
 						</NcCheckboxRadioSwitch>
-						<NcCheckboxRadioSwitch v-if="config.isResharingAllowed && share.type !== SHARE_TYPES.SHARE_TYPE_LINK"
+						<NcCheckboxRadioSwitch v-if="config.isResharingAllowed && share.type !== ShareType.Link"
 							:disabled="!canSetReshare"
 							:checked.sync="canReshare"
 							data-cy-files-sharing-share-permissions-checkbox="share">
@@ -277,7 +277,6 @@ import ExternalShareAction from '../components/ExternalShareAction.vue'
 import GeneratePassword from '../utils/GeneratePassword.ts'
 import Share from '../models/Share.ts'
 import ShareRequests from '../mixins/ShareRequests.js'
-import ShareTypes from '../mixins/ShareTypes.js'
 import SharesMixin from '../mixins/SharesMixin.js'
 import logger from '../services/logger.ts'
 
@@ -312,7 +311,7 @@ export default {
 		MenuUpIcon,
 		DotsHorizontalIcon,
 	},
-	mixins: [ShareTypes, ShareRequests, SharesMixin],
+	mixins: [ShareRequests, SharesMixin],
 	props: {
 		shareRequestValue: {
 			type: Object,
@@ -347,23 +346,23 @@ export default {
 	computed: {
 		title() {
 			switch (this.share.type) {
-			case this.SHARE_TYPES.SHARE_TYPE_USER:
+			case ShareType.User:
 				return t('files_sharing', 'Share with {userName}', { userName: this.share.shareWithDisplayName })
-			case this.SHARE_TYPES.SHARE_TYPE_EMAIL:
-				return t('files_sharing', 'Share with email {email}', { email: this.share.shareWith })
-			case this.SHARE_TYPES.SHARE_TYPE_LINK:
+			case ShareType.Email:
+			    return t('files_sharing', 'Share with email {email}', { email: this.share.shareWith })
+			case ShareType.Link:
 				return t('files_sharing', 'Share link')
-			case this.SHARE_TYPES.SHARE_TYPE_GROUP:
+			case ShareType.Group:
 				return t('files_sharing', 'Share with group')
-			case this.SHARE_TYPES.SHARE_TYPE_ROOM:
+			case ShareType.Room:
 				return t('files_sharing', 'Share in conversation')
-			case this.SHARE_TYPES.SHARE_TYPE_REMOTE: {
+			case ShareType.Remote: {
 				const [user, server] = this.share.shareWith.split('@')
 				return t('files_sharing', 'Share with {user} on remote server {server}', { user, server })
 			}
-			case this.SHARE_TYPES.SHARE_TYPE_REMOTE_GROUP:
+			case ShareType.RemoteGroup:
 				return t('files_sharing', 'Share with remote group')
-			case this.SHARE_TYPES.SHARE_TYPE_GUEST:
+			case ShareType.Guest:
 				return t('files_sharing', 'Share with guest')
 			default: {
 				if (this.share.id) {
@@ -531,17 +530,17 @@ export default {
 			return new Date(new Date().setDate(new Date().getDate() + 1))
 		},
 		isUserShare() {
-			return this.share.type === this.SHARE_TYPES.SHARE_TYPE_USER
+			return this.share.type === ShareType.User
 		},
 		isGroupShare() {
-			return this.share.type === this.SHARE_TYPES.SHARE_TYPE_GROUP
+			return this.share.type === ShareType.Group
 		},
 		isNewShare() {
 			return !this.share.id
 		},
 		allowsFileDrop() {
 			if (this.isFolder && this.config.isPublicUploadEnabled) {
-				if (this.share.type === this.SHARE_TYPES.SHARE_TYPE_LINK || this.share.type === this.SHARE_TYPES.SHARE_TYPE_EMAIL) {
+				if (this.share.type === ShareType.Link || this.share.type === ShareType.Email) {
 					return true
 				}
 			}
@@ -616,8 +615,8 @@ export default {
 		},
 		canRemoveReadPermission() {
 			return this.allowsFileDrop && (
-				this.share.type === this.SHARE_TYPES.SHARE_TYPE_LINK
-					|| this.share.type === this.SHARE_TYPES.SHARE_TYPE_EMAIL
+				this.share.type === ShareType.Link
+					|| this.share.type === ShareType.Email
 			)
 		},
 		// if newPassword exists, but is empty, it means
@@ -676,7 +675,7 @@ export default {
 		 */
 		isEmailShareType() {
 			return this.share
-				? this.share.type === this.SHARE_TYPES.SHARE_TYPE_EMAIL
+				? this.share.type === ShareType.Email
 				: false
 		},
 		canTogglePasswordProtectedByTalkAvailable() {
@@ -1024,22 +1023,22 @@ export default {
 		},
 		getShareTypeIcon(type) {
 			switch (type) {
-			case this.SHARE_TYPES.SHARE_TYPE_LINK:
+			case ShareType.Link:
 				return LinkIcon
-			case this.SHARE_TYPES.SHARE_TYPE_GUEST:
+			case ShareType.Guest:
 				return UserIcon
-			case this.SHARE_TYPES.SHARE_TYPE_REMOTE_GROUP:
-			case this.SHARE_TYPES.SHARE_TYPE_GROUP:
+			case ShareType.RemoteGroup:
+			case ShareType.Group:
 				return GroupIcon
-			case this.SHARE_TYPES.SHARE_TYPE_EMAIL:
+			case ShareType.Email:
 				return EmailIcon
-			case this.SHARE_TYPES.SHARE_TYPE_CIRCLE:
+			case ShareType.Team:
 				return CircleIcon
-			case this.SHARE_TYPES.SHARE_TYPE_ROOM:
+			case ShareType.Room:
 				return ShareIcon
-			case this.SHARE_TYPES.SHARE_TYPE_DECK:
+			case ShareType.Deck:
 				return ShareIcon
-			case this.SHARE_TYPES.SHARE_TYPE_SCIENCEMESH:
+			case ShareType.ScienceMesh:
 				return ShareIcon
 			default:
 				return null // Or a default icon component if needed
-- 
cgit v1.2.3

