Skip to content

Commit 6eef604

Browse files
committed
feat(files_sharing): Modularize SharingInput to adapt with share sections
Signed-off-by: nfebe <fenn25.fn@gmail.com>
1 parent 697119e commit 6eef604

File tree

2 files changed

+47
-3
lines changed

2 files changed

+47
-3
lines changed

apps/files_sharing/src/components/SharingInput.vue

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ export default {
7373
type: Boolean,
7474
required: true,
7575
},
76+
isExternal: {
77+
type: Boolean,
78+
default: false,
79+
},
80+
placeholder: {
81+
type: String,
82+
default: '',
83+
},
7684
},
7785
7886
data() {
@@ -105,6 +113,10 @@ export default {
105113
if (!this.canReshare) {
106114
return t('files_sharing', 'Resharing is not allowed')
107115
}
116+
if (this.placeholder) {
117+
return this.placeholder
118+
}
119+
108120
// We can always search with email addresses for users too
109121
if (!allowRemoteSharing) {
110122
return t('files_sharing', 'Name or email …')
@@ -170,16 +182,19 @@ export default {
170182
const shareType = [
171183
ShareType.User,
172184
ShareType.Group,
173-
ShareType.Remote,
174-
ShareType.RemoteGroup,
175185
ShareType.Team,
176186
ShareType.Room,
177187
ShareType.Guest,
178188
ShareType.Deck,
179189
ShareType.ScienceMesh,
180190
]
181191
182-
if (getCapabilities().files_sharing.public.enabled === true) {
192+
if (this.isExternal) {
193+
shareType.push(ShareType.Remote)
194+
shareType.push(ShareType.RemoteGroup)
195+
}
196+
197+
if (getCapabilities().files_sharing.public.enabled === true && this.isExternal) {
183198
shareType.push(ShareType.Email)
184199
}
185200

apps/files_sharing/src/views/SharingTab.vue

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
:link-shares="linkShares"
3838
:reshare="reshare"
3939
:shares="shares"
40+
:placeholder="t('files_sharing', 'Add users and teams')"
4041
@open-sharing-details="toggleShareDetailsView" />
4142

4243
<!-- other shares list -->
@@ -58,6 +59,15 @@
5859
<h6>{{ t('files_sharing', 'External shares') }}</h6>
5960
<InfoIcon v-tooltip="t('files_sharing', 'Displays shares made to outside users.')" :size="16" />
6061
</div>
62+
<SharingInput v-if="!loading"
63+
:can-reshare="canReshare"
64+
:file-info="fileInfo"
65+
:link-shares="linkShares"
66+
:is-external="true"
67+
:placeholder="t('files_sharing', 'Email, federated cloud id')"
68+
:reshare="reshare"
69+
:shares="shares"
70+
@open-sharing-details="toggleShareDetailsView" />
6171
<!-- link shares list -->
6272
<SharingLinkList v-if="!loading"
6373
ref="linkShareList"
@@ -105,12 +115,15 @@ import { generateOcsUrl } from '@nextcloud/router'
105115
import { CollectionList } from 'nextcloud-vue-collections'
106116
import { ShareType } from '@nextcloud/sharing'
107117
118+
import CloudIcon from 'vue-material-design-icons/Cloud.vue'
119+
import EmailIcon from 'vue-material-design-icons/Email.vue'
108120
import InfoIcon from 'vue-material-design-icons/Information.vue'
109121
110122
import axios from '@nextcloud/axios'
111123
import moment from '@nextcloud/moment'
112124
import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip.js'
113125
import NcAvatar from '@nextcloud/vue/dist/Components/NcAvatar.js'
126+
import NcInputField from '@nextcloud/vue/dist/Components/NcInputField.js'
114127
115128
import { shareWithTitle } from '../utils/SharedWithMe.js'
116129
@@ -125,6 +138,8 @@ import SharingLinkList from './SharingLinkList.vue'
125138
import SharingList from './SharingList.vue'
126139
import SharingDetailsTab from './SharingDetailsTab.vue'
127140
141+
import ShareDetails from '../mixins/ShareDetails.js'
142+
128143
export default {
129144
name: 'SharingTab',
130145
@@ -134,8 +149,11 @@ export default {
134149
135150
components: {
136151
CollectionList,
152+
CloudIcon,
153+
EmailIcon,
137154
InfoIcon,
138155
NcAvatar,
156+
NcInputField,
139157
SharingEntryInternal,
140158
SharingEntrySimple,
141159
SharingInherited,
@@ -144,6 +162,7 @@ export default {
144162
SharingList,
145163
SharingDetailsTab,
146164
},
165+
mixins: [ShareDetails],
147166
148167
data() {
149168
return {
@@ -166,6 +185,9 @@ export default {
166185
showSharingDetailsView: false,
167186
shareDetailsData: {},
168187
returnFocusElement: null,
188+
189+
// external shars
190+
externalShareQuery: '',
169191
}
170192
},
171193
@@ -183,6 +205,13 @@ export default {
183205
return !!(this.fileInfo.permissions & OC.PERMISSION_SHARE)
184206
|| !!(this.reshare && this.reshare.hasSharePermission && this.config.isResharingAllowed)
185207
},
208+
209+
ExternalShareIcon() {
210+
if (this.externalShareQuery.includes('@')) {
211+
return EmailIcon
212+
}
213+
return CloudIcon
214+
},
186215
},
187216
188217
methods: {

0 commit comments

Comments
 (0)