Skip to content

Commit 5ee4c9e

Browse files
authored
Merge pull request #49351 from nextcloud/fix/no-issue/no-reshare-perms-4-email-shares
enh: Improvements on sharing details
2 parents f1754ee + 19b0551 commit 5ee4c9e

File tree

68 files changed

+170
-193
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+170
-193
lines changed

apps/dav/src/components/AbsenceForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export default {
141141
async getSuggestions(search) {
142142
143143
const shareType = [
144-
ShareType.SHARE_TYPE_USER,
144+
ShareType.User,
145145
]
146146
147147
let request = null

apps/files_sharing/src/components/FileListFilterAccount.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import type { IAccountData } from '../filters/AccountFilter.ts'
4040
4141
import { translate as t } from '@nextcloud/l10n'
42+
import { ShareType } from '@nextcloud/sharing'
4243
import { mdiAccountMultiple } from '@mdi/js'
4344
import { useBrowserLocation } from '@vueuse/core'
4445
import { computed, ref, watch } from 'vue'
@@ -49,7 +50,6 @@ import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
4950
import NcActionInput from '@nextcloud/vue/dist/Components/NcActionInput.js'
5051
import NcAvatar from '@nextcloud/vue/dist/Components/NcAvatar.js'
5152
import NcIconSvgWrapper from '@nextcloud/vue/dist/Components/NcIconSvgWrapper.js'
52-
import { ShareType } from '@nextcloud/sharing'
5353
5454
interface IUserSelectData {
5555
id: string

apps/files_sharing/src/components/SharingEntry.vue

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<template>
77
<li class="sharing-entry">
88
<NcAvatar class="sharing-entry__avatar"
9-
:is-no-user="share.type !== SHARE_TYPES.SHARE_TYPE_USER"
9+
:is-no-user="share.type !== ShareType.User"
1010
:user="share.shareWith"
1111
:display-name="share.shareWithDisplayName"
1212
:menu-position="'left'"
@@ -41,6 +41,8 @@
4141
</template>
4242

4343
<script>
44+
import { ShareType } from '@nextcloud/sharing'
45+
4446
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
4547
import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js'
4648
import NcAvatar from '@nextcloud/vue/dist/Components/NcAvatar.js'
@@ -67,15 +69,15 @@ export default {
6769
computed: {
6870
title() {
6971
let title = this.share.shareWithDisplayName
70-
if (this.share.type === this.SHARE_TYPES.SHARE_TYPE_GROUP) {
72+
if (this.share.type === ShareType.Group) {
7173
title += ` (${t('files_sharing', 'group')})`
72-
} else if (this.share.type === this.SHARE_TYPES.SHARE_TYPE_ROOM) {
74+
} else if (this.share.type === ShareType.Room) {
7375
title += ` (${t('files_sharing', 'conversation')})`
74-
} else if (this.share.type === this.SHARE_TYPES.SHARE_TYPE_REMOTE) {
76+
} else if (this.share.type === ShareType.Remote) {
7577
title += ` (${t('files_sharing', 'remote')})`
76-
} else if (this.share.type === this.SHARE_TYPES.SHARE_TYPE_REMOTE_GROUP) {
78+
} else if (this.share.type === ShareType.RemoteGroup) {
7779
title += ` (${t('files_sharing', 'remote group')})`
78-
} else if (this.share.type === this.SHARE_TYPES.SHARE_TYPE_GUEST) {
80+
} else if (this.share.type === ShareType.Guest) {
7981
title += ` (${t('files_sharing', 'guest')})`
8082
}
8183
if (!this.isShareOwner && this.share.ownerDisplayName) {
@@ -93,9 +95,9 @@ export default {
9395
user: this.share.shareWithDisplayName,
9496
owner: this.share.ownerDisplayName,
9597
}
96-
if (this.share.type === this.SHARE_TYPES.SHARE_TYPE_GROUP) {
98+
if (this.share.type === ShareType.Group) {
9799
return t('files_sharing', 'Shared with the group {user} by {owner}', data)
98-
} else if (this.share.type === this.SHARE_TYPES.SHARE_TYPE_ROOM) {
100+
} else if (this.share.type === ShareType.Room) {
99101
return t('files_sharing', 'Shared with the conversation {user} by {owner}', data)
100102
}
101103
@@ -108,7 +110,7 @@ export default {
108110
* @return {boolean}
109111
*/
110112
hasStatus() {
111-
if (this.share.type !== this.SHARE_TYPES.SHARE_TYPE_USER) {
113+
if (this.share.type !== ShareType.User) {
112114
return false
113115
}
114116

apps/files_sharing/src/components/SharingEntryLink.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ export default {
446446
*/
447447
isEmailShareType() {
448448
return this.share
449-
? this.share.type === this.SHARE_TYPES.SHARE_TYPE_EMAIL
449+
? this.share.type === ShareType.Email
450450
: false
451451
},
452452

apps/files_sharing/src/components/SharingEntryQuickShareSelect.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
</template>
2828

2929
<script>
30+
import { ShareType } from '@nextcloud/sharing'
3031
import DropdownIcon from 'vue-material-design-icons/TriangleSmallDown.vue'
3132
import SharesMixin from '../mixins/SharesMixin.js'
3233
import ShareDetails from '../mixins/ShareDetails.js'
33-
import ShareTypes from '../mixins/ShareTypes.js'
3434
import NcActions from '@nextcloud/vue/dist/Components/NcActions.js'
3535
import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
3636
import IconEyeOutline from 'vue-material-design-icons/EyeOutline.vue'
@@ -52,7 +52,7 @@ export default {
5252
NcActionButton,
5353
},
5454
55-
mixins: [SharesMixin, ShareDetails, ShareTypes],
55+
mixins: [SharesMixin, ShareDetails],
5656
5757
props: {
5858
share: {
@@ -122,7 +122,7 @@ export default {
122122
supportsFileDrop() {
123123
if (this.isFolder && this.config.isPublicUploadEnabled) {
124124
const shareType = this.share.type ?? this.share.shareType
125-
return [this.SHARE_TYPES.SHARE_TYPE_LINK, this.SHARE_TYPES.SHARE_TYPE_EMAIL].includes(shareType)
125+
return [ShareType.Link, ShareType.Email].includes(shareType)
126126
}
127127
return false
128128
},

apps/files_sharing/src/components/SharingInput.vue

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js'
3838
import Config from '../services/ConfigService.ts'
3939
import Share from '../models/Share.ts'
4040
import ShareRequests from '../mixins/ShareRequests.js'
41-
import ShareTypes from '../mixins/ShareTypes.js'
4241
import ShareDetails from '../mixins/ShareDetails.js'
42+
import { ShareType } from '@nextcloud/sharing'
4343
4444
export default {
4545
name: 'SharingInput',
@@ -48,7 +48,7 @@ export default {
4848
NcSelect,
4949
},
5050
51-
mixins: [ShareTypes, ShareRequests, ShareDetails],
51+
mixins: [ShareRequests, ShareDetails],
5252
5353
props: {
5454
shares: {
@@ -168,20 +168,10 @@ export default {
168168
lookup = true
169169
}
170170
171-
const shareType = [
172-
this.SHARE_TYPES.SHARE_TYPE_USER,
173-
this.SHARE_TYPES.SHARE_TYPE_GROUP,
174-
this.SHARE_TYPES.SHARE_TYPE_REMOTE,
175-
this.SHARE_TYPES.SHARE_TYPE_REMOTE_GROUP,
176-
this.SHARE_TYPES.SHARE_TYPE_CIRCLE,
177-
this.SHARE_TYPES.SHARE_TYPE_ROOM,
178-
this.SHARE_TYPES.SHARE_TYPE_GUEST,
179-
this.SHARE_TYPES.SHARE_TYPE_DECK,
180-
this.SHARE_TYPES.SHARE_TYPE_SCIENCEMESH,
181-
]
171+
const shareType = Object.values(ShareType)
182172
183173
if (getCapabilities().files_sharing.public.enabled === true) {
184-
shareType.push(this.SHARE_TYPES.SHARE_TYPE_EMAIL)
174+
shareType.push(ShareType.Email)
185175
}
186176
187177
let request = null
@@ -318,7 +308,7 @@ export default {
318308
return arr
319309
}
320310
try {
321-
if (share.value.shareType === this.SHARE_TYPES.SHARE_TYPE_USER) {
311+
if (share.value.shareType === ShareType.User) {
322312
// filter out current user
323313
if (share.value.shareWith === getCurrentUser().uid) {
324314
return arr
@@ -331,7 +321,7 @@ export default {
331321
}
332322
333323
// filter out existing mail shares
334-
if (share.value.shareType === this.SHARE_TYPES.SHARE_TYPE_EMAIL) {
324+
if (share.value.shareType === ShareType.Email) {
335325
const emails = this.linkShares.map(elem => elem.shareWith)
336326
if (emails.indexOf(share.value.shareWith.trim()) !== -1) {
337327
return arr
@@ -369,42 +359,42 @@ export default {
369359
*/
370360
shareTypeToIcon(type) {
371361
switch (type) {
372-
case this.SHARE_TYPES.SHARE_TYPE_GUEST:
362+
case ShareType.Guest:
373363
// default is a user, other icons are here to differentiate
374364
// themselves from it, so let's not display the user icon
375-
// case this.SHARE_TYPES.SHARE_TYPE_REMOTE:
376-
// case this.SHARE_TYPES.SHARE_TYPE_USER:
365+
// case ShareType.Remote:
366+
// case ShareType.User:
377367
return {
378368
icon: 'icon-user',
379369
iconTitle: t('files_sharing', 'Guest'),
380370
}
381-
case this.SHARE_TYPES.SHARE_TYPE_REMOTE_GROUP:
382-
case this.SHARE_TYPES.SHARE_TYPE_GROUP:
371+
case ShareType.RemoteGroup:
372+
case ShareType.Group:
383373
return {
384374
icon: 'icon-group',
385375
iconTitle: t('files_sharing', 'Group'),
386376
}
387-
case this.SHARE_TYPES.SHARE_TYPE_EMAIL:
377+
case ShareType.Email:
388378
return {
389379
icon: 'icon-mail',
390380
iconTitle: t('files_sharing', 'Email'),
391381
}
392-
case this.SHARE_TYPES.SHARE_TYPE_CIRCLE:
382+
case ShareType.Team:
393383
return {
394384
icon: 'icon-teams',
395385
iconTitle: t('files_sharing', 'Team'),
396386
}
397-
case this.SHARE_TYPES.SHARE_TYPE_ROOM:
387+
case ShareType.Room:
398388
return {
399389
icon: 'icon-room',
400390
iconTitle: t('files_sharing', 'Talk conversation'),
401391
}
402-
case this.SHARE_TYPES.SHARE_TYPE_DECK:
392+
case ShareType.Deck:
403393
return {
404394
icon: 'icon-deck',
405395
iconTitle: t('files_sharing', 'Deck board'),
406396
}
407-
case this.SHARE_TYPES.SHARE_TYPE_SCIENCEMESH:
397+
case ShareType.Sciencemesh:
408398
return {
409399
icon: 'icon-sciencemesh',
410400
iconTitle: t('files_sharing', 'ScienceMesh'),
@@ -422,13 +412,13 @@ export default {
422412
*/
423413
formatForMultiselect(result) {
424414
let subname
425-
if (result.value.shareType === this.SHARE_TYPES.SHARE_TYPE_USER && this.config.shouldAlwaysShowUnique) {
415+
if (result.value.shareType === ShareType.User && this.config.shouldAlwaysShowUnique) {
426416
subname = result.shareWithDisplayNameUnique ?? ''
427-
} else if ((result.value.shareType === this.SHARE_TYPES.SHARE_TYPE_REMOTE
428-
|| result.value.shareType === this.SHARE_TYPES.SHARE_TYPE_REMOTE_GROUP
417+
} else if ((result.value.shareType === ShareType.Remote
418+
|| result.value.shareType === ShareType.RemoteGroup
429419
) && result.value.server) {
430420
subname = t('files_sharing', 'on {server}', { server: result.value.server })
431-
} else if (result.value.shareType === this.SHARE_TYPES.SHARE_TYPE_EMAIL) {
421+
} else if (result.value.shareType === ShareType.Email) {
432422
subname = result.value.shareWith
433423
} else {
434424
subname = result.shareWithDescription ?? ''
@@ -438,7 +428,7 @@ export default {
438428
shareWith: result.value.shareWith,
439429
shareType: result.value.shareType,
440430
user: result.uuid || result.value.shareWith,
441-
isNoUser: result.value.shareType !== this.SHARE_TYPES.SHARE_TYPE_USER,
431+
isNoUser: result.value.shareType !== ShareType.User,
442432
displayName: result.name || result.label,
443433
subname,
444434
shareWithDisplayNameUnique: result.shareWithDisplayNameUnique || '',

apps/files_sharing/src/mixins/ShareTypes.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

apps/files_sharing/src/mixins/SharesMixin.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import { getCurrentUser } from '@nextcloud/auth'
77
import { showError, showSuccess } from '@nextcloud/dialogs'
8+
import { ShareType } from '@nextcloud/sharing'
89
import { emit } from '@nextcloud/event-bus'
910
import { fetchNode } from '../services/WebdavClient.ts'
1011

@@ -13,7 +14,6 @@ import debounce from 'debounce'
1314

1415
import Share from '../models/Share.ts'
1516
import SharesRequests from './ShareRequests.js'
16-
import ShareTypes from './ShareTypes.js'
1717
import Config from '../services/ConfigService.ts'
1818
import logger from '../services/logger.ts'
1919

@@ -22,7 +22,7 @@ import {
2222
} from '../lib/SharePermissionsToolBox.js'
2323

2424
export default {
25-
mixins: [SharesRequests, ShareTypes],
25+
mixins: [SharesRequests],
2626

2727
props: {
2828
fileInfo: {
@@ -44,6 +44,7 @@ export default {
4444
return {
4545
config: new Config(),
4646
node: null,
47+
ShareType,
4748

4849
// errors helpers
4950
errors: {},
@@ -114,10 +115,10 @@ export default {
114115
},
115116
isPublicShare() {
116117
const shareType = this.share.shareType ?? this.share.type
117-
return [this.SHARE_TYPES.SHARE_TYPE_LINK, this.SHARE_TYPES.SHARE_TYPE_EMAIL].includes(shareType)
118+
return [ShareType.Link, ShareType.Email].includes(shareType)
118119
},
119120
isRemoteShare() {
120-
return this.share.type === this.SHARE_TYPES.SHARE_TYPE_REMOTE_GROUP || this.share.type === this.SHARE_TYPES.SHARE_TYPE_REMOTE
121+
return this.share.type === ShareType.RemoteGroup || this.share.type === ShareType.Remote
121122
},
122123
isShareOwner() {
123124
return this.share && this.share.owner === getCurrentUser().uid

apps/files_sharing/src/services/ExternalShareActions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export default class ExternalShareActions {
4848
if (typeof action !== 'object'
4949
|| typeof action.id !== 'string'
5050
|| typeof action.data !== 'function' // () => {disabled: true}
51-
|| !Array.isArray(action.shareType) // [\@nextcloud/sharing.Types.SHARE_TYPE_LINK, ...]
51+
|| !Array.isArray(action.shareType) // [\@nextcloud/sharing.Types.Link, ...]
5252
|| typeof action.handlers !== 'object' // {click: () => {}, ...}
5353
|| !Object.values(action.handlers).every(handler => typeof handler === 'function')) {
5454
console.error('Invalid action provided', action)

apps/files_sharing/src/share.js

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/* eslint-disable */
88
import escapeHTML from 'escape-html'
99

10-
import { Type as ShareTypes } from '@nextcloud/sharing'
10+
import { ShareType } from '@nextcloud/sharing'
1111
import { getCapabilities } from '@nextcloud/capabilities'
1212

1313
(function() {
@@ -155,25 +155,23 @@ import { getCapabilities } from '@nextcloud/capabilities'
155155
var hasShares = false
156156
_.each(shareTypesStr.split(',') || [], function(shareTypeStr) {
157157
let shareType = parseInt(shareTypeStr, 10)
158-
if (shareType === ShareTypes.SHARE_TYPE_LINK) {
158+
if (shareType === ShareType.Link) {
159159
hasLink = true
160-
} else if (shareType === ShareTypes.SHARE_TYPE_EMAIL) {
160+
} else if (shareType === ShareType.Email) {
161161
hasLink = true
162-
} else if (shareType === ShareTypes.SHARE_TYPE_USER) {
162+
} else if (shareType === ShareType.User) {
163163
hasShares = true
164-
} else if (shareType === ShareTypes.SHARE_TYPE_GROUP) {
164+
} else if (shareType === ShareType.Group) {
165165
hasShares = true
166-
} else if (shareType === ShareTypes.SHARE_TYPE_REMOTE) {
166+
} else if (shareType === ShareType.Remote) {
167167
hasShares = true
168-
} else if (shareType === ShareTypes.SHARE_TYPE_REMOTE_GROUP) {
168+
} else if (shareType === ShareType.RemoteGroup) {
169169
hasShares = true
170-
} else if (shareType === ShareTypes.SHARE_TYPE_CIRCLE) {
170+
} else if (shareType === ShareType.Team) {
171171
hasShares = true
172-
} else if (shareType === ShareTypes.SHARE_TYPE_ROOM) {
172+
} else if (shareType === ShareType.Room) {
173173
hasShares = true
174-
} else if (shareType === ShareTypes.SHARE_TYPE_DECK) {
175-
hasShares = true
176-
} else if (shareType === ShareTypes.SHARE_TYPE_SCIENCEMESH) {
174+
} else if (shareType === ShareType.Deck) {
177175
hasShares = true
178176
}
179177
})
@@ -204,8 +202,8 @@ import { getCapabilities } from '@nextcloud/capabilities'
204202
permissions: OC.PERMISSION_ALL,
205203
iconClass: function(fileName, context) {
206204
var shareType = parseInt(context.$file.data('share-types'), 10)
207-
if (shareType === ShareTypes.SHARE_TYPE_EMAIL
208-
|| shareType === ShareTypes.SHARE_TYPE_LINK) {
205+
if (shareType === ShareType.Email
206+
|| shareType === ShareType.Link) {
209207
return 'icon-public'
210208
}
211209
return 'icon-shared'

0 commit comments

Comments
 (0)