Skip to content

Commit 488dcfb

Browse files
nfebeartonge
andcommitted
Improve sharing flow
This commit introduces the following changes: - Does not create new share once user is selected for internal shares - Adds a `SharingDetails` view for share configurations - Adds a quick share select to enable fast changes in share permisions. Resolves: #26691 Signed-off-by: fenn-cs <[email protected]> Co-authored-by: Louis Chemineau <[email protected]>
1 parent 23197a8 commit 488dcfb

File tree

35 files changed

+91842
-554
lines changed

35 files changed

+91842
-554
lines changed

apps/files_sharing/src/components/SharingEntry.vue

Lines changed: 54 additions & 353 deletions
Large diffs are not rendered by default.

apps/files_sharing/src/components/SharingEntryLink.vue

Lines changed: 36 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,18 @@
2525
<NcAvatar :is-no-user="true"
2626
:icon-class="isEmailShareType ? 'avatar-link-share icon-mail-white' : 'avatar-link-share icon-public-white'"
2727
class="sharing-entry__avatar" />
28-
<div class="sharing-entry__desc">
28+
<div class="sharing-entry__desc" @click.prevent="toggleQuickShareSelect">
2929
<span class="sharing-entry__title" :title="title">
3030
{{ title }}
3131
</span>
3232
<p v-if="subtitle">
3333
{{ subtitle }}
3434
</p>
35+
<QuickShareSelect v-if="share && share.permissions !== undefined"
36+
:share="share"
37+
:file-info="fileInfo"
38+
:toggle="showDropdown"
39+
@open-sharing-details="openShareDetailsForCustomSettings(share)" />
3540
</div>
3641

3742
<!-- clipboard -->
@@ -123,110 +128,13 @@
123128
@close="onMenuClose">
124129
<template v-if="share">
125130
<template v-if="share.canEdit && canReshare">
126-
<!-- Custom Label -->
127-
<NcActionInput ref="label"
128-
:class="{ error: errors.label }"
129-
:disabled="saving"
130-
:label="t('files_sharing', 'Share label')"
131-
:value="share.newLabel !== undefined ? share.newLabel : share.label"
132-
icon="icon-edit"
133-
maxlength="255"
134-
@update:value="onLabelChange"
135-
@submit="onLabelSubmit" />
136-
137-
<SharePermissionsEditor :can-reshare="canReshare"
138-
:share.sync="share"
139-
:file-info="fileInfo" />
140-
141-
<NcActionSeparator />
142-
143-
<NcActionCheckbox :checked.sync="share.hideDownload"
144-
:disabled="saving || canChangeHideDownload"
145-
@change="queueUpdate('hideDownload')">
146-
{{ t('files_sharing', 'Hide download') }}
147-
</NcActionCheckbox>
148-
149-
<!-- password -->
150-
<NcActionCheckbox :checked.sync="isPasswordProtected"
151-
:disabled="config.enforcePasswordForPublicLink || saving"
152-
class="share-link-password-checkbox"
153-
@uncheck="onPasswordDisable">
154-
{{ config.enforcePasswordForPublicLink
155-
? t('files_sharing', 'Password protection (enforced)')
156-
: t('files_sharing', 'Password protect') }}
157-
</NcActionCheckbox>
158-
159-
<NcActionInput v-if="isPasswordProtected"
160-
ref="password"
161-
class="share-link-password"
162-
:class="{ error: errors.password}"
163-
:disabled="saving"
164-
:show-trailing-button="hasUnsavedPassword"
165-
:required="config.enforcePasswordForPublicLink"
166-
:value="hasUnsavedPassword ? share.newPassword : '***************'"
167-
icon="icon-password"
168-
autocomplete="new-password"
169-
:type="hasUnsavedPassword ? 'text': 'password'"
170-
@update:value="onPasswordChange"
171-
@submit="onPasswordSubmit">
172-
{{ t('files_sharing', 'Enter a password') }}
173-
</NcActionInput>
174-
<NcActionText v-if="isEmailShareType && passwordExpirationTime" icon="icon-info">
175-
{{ t('files_sharing', 'Password expires {passwordExpirationTime}', {passwordExpirationTime}) }}
176-
</NcActionText>
177-
<NcActionText v-else-if="isEmailShareType && passwordExpirationTime !== null" icon="icon-error">
178-
{{ t('files_sharing', 'Password expired') }}
179-
</NcActionText>
180-
181-
<!-- password protected by Talk -->
182-
<NcActionCheckbox v-if="isPasswordProtectedByTalkAvailable"
183-
:checked.sync="isPasswordProtectedByTalk"
184-
:disabled="!canTogglePasswordProtectedByTalkAvailable || saving"
185-
class="share-link-password-talk-checkbox"
186-
@change="onPasswordProtectedByTalkChange">
187-
{{ t('files_sharing', 'Video verification') }}
188-
</NcActionCheckbox>
189-
190-
<!-- expiration date -->
191-
<NcActionCheckbox :checked.sync="hasExpirationDate"
192-
:disabled="config.isDefaultExpireDateEnforced || saving"
193-
class="share-link-expire-date-checkbox"
194-
@uncheck="onExpirationDisable">
195-
{{ config.isDefaultExpireDateEnforced
196-
? t('files_sharing', 'Expiration date (enforced)')
197-
: t('files_sharing', 'Set expiration date') }}
198-
</NcActionCheckbox>
199-
<NcActionInput v-if="hasExpirationDate"
200-
ref="expireDate"
201-
:is-native-picker="true"
202-
:hide-label="true"
203-
class="share-link-expire-date"
204-
:class="{ error: errors.expireDate}"
205-
:disabled="saving"
206-
:value="new Date(share.expireDate)"
207-
type="date"
208-
:min="dateTomorrow"
209-
:max="dateMaxEnforced"
210-
@input="onExpirationChange">
211-
{{ t('files_sharing', 'Enter a date') }}
212-
</NcActionInput>
213-
214-
<!-- note -->
215-
<NcActionCheckbox :checked.sync="hasNote"
216-
:disabled="saving"
217-
@uncheck="queueUpdate('note')">
218-
{{ t('files_sharing', 'Note to recipient') }}
219-
</NcActionCheckbox>
220-
221-
<NcActionTextEditable v-if="hasNote"
222-
ref="note"
223-
:class="{ error: errors.note}"
224-
:disabled="saving"
225-
:placeholder="t('files_sharing', 'Enter a note for the share recipient')"
226-
:value="share.newNote || share.note"
227-
icon="icon-edit"
228-
@update:value="onNoteChange"
229-
@submit="onNoteSubmit" />
131+
<NcActionButton :disabled="saving"
132+
@click.prevent="openSharingDetails">
133+
<template #icon>
134+
<Tune />
135+
</template>
136+
{{ t('files_sharing', 'Customize link') }}
137+
</NcActionButton>
230138
</template>
231139

232140
<NcActionSeparator />
@@ -248,18 +156,19 @@
248156
{{ name }}
249157
</NcActionLink>
250158

251-
<NcActionButton v-if="share.canDelete"
252-
icon="icon-close"
253-
:disabled="saving"
254-
@click.prevent="onDelete">
255-
{{ t('files_sharing', 'Unshare') }}
256-
</NcActionButton>
257159
<NcActionButton v-if="!isEmailShareType && canReshare"
258160
class="new-share-link"
259161
icon="icon-add"
260162
@click.prevent.stop="onNewLinkShare">
261163
{{ t('files_sharing', 'Add another link') }}
262164
</NcActionButton>
165+
166+
<NcActionButton v-if="share.canDelete"
167+
icon="icon-close"
168+
:disabled="saving"
169+
@click.prevent="onDelete">
170+
{{ t('files_sharing', 'Unshare') }}
171+
</NcActionButton>
263172
</template>
264173

265174
<!-- Create new share -->
@@ -283,39 +192,40 @@ import { Type as ShareTypes } from '@nextcloud/sharing'
283192
import Vue from 'vue'
284193
285194
import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
286-
import NcActionCheckbox from '@nextcloud/vue/dist/Components/NcActionCheckbox.js'
287195
import NcActionInput from '@nextcloud/vue/dist/Components/NcActionInput.js'
288196
import NcActionLink from '@nextcloud/vue/dist/Components/NcActionLink.js'
289197
import NcActionText from '@nextcloud/vue/dist/Components/NcActionText.js'
290198
import NcActionSeparator from '@nextcloud/vue/dist/Components/NcActionSeparator.js'
291-
import NcActionTextEditable from '@nextcloud/vue/dist/Components/NcActionTextEditable.js'
292199
import NcActions from '@nextcloud/vue/dist/Components/NcActions.js'
293200
import NcAvatar from '@nextcloud/vue/dist/Components/NcAvatar.js'
294201
202+
import Tune from 'vue-material-design-icons/Tune.vue'
203+
204+
import QuickShareSelect from './SharingEntryQuickShareSelect.vue'
205+
295206
import ExternalShareAction from './ExternalShareAction.vue'
296-
import SharePermissionsEditor from './SharePermissionsEditor.vue'
297207
import GeneratePassword from '../utils/GeneratePassword.js'
298208
import Share from '../models/Share.js'
299209
import SharesMixin from '../mixins/SharesMixin.js'
210+
import ShareDetails from '../mixins/ShareDetails.js'
300211
301212
export default {
302213
name: 'SharingEntryLink',
303214
304215
components: {
216+
ExternalShareAction,
305217
NcActions,
306218
NcActionButton,
307-
NcActionCheckbox,
308219
NcActionInput,
309220
NcActionLink,
310221
NcActionText,
311-
NcActionTextEditable,
312222
NcActionSeparator,
313223
NcAvatar,
314-
ExternalShareAction,
315-
SharePermissionsEditor,
224+
Tune,
225+
QuickShareSelect,
316226
},
317227
318-
mixins: [SharesMixin],
228+
mixins: [SharesMixin, ShareDetails],
319229
320230
props: {
321231
canReshare: {
@@ -330,6 +240,7 @@ export default {
330240
331241
data() {
332242
return {
243+
showDropdown: false,
333244
copySuccess: true,
334245
copied: false,
335246
@@ -593,7 +504,6 @@ export default {
593504
594505
canChangeHideDownload() {
595506
const hasDisabledDownload = (shareAttribute) => shareAttribute.key === 'download' && shareAttribute.scope === 'permissions' && shareAttribute.enabled === false
596-
597507
return this.fileInfo.shareAttributes.some(hasDisabledDownload)
598508
},
599509
},
@@ -671,7 +581,7 @@ export default {
671581
* accordingly
672582
*
673583
* @param {Share} share the new share
674-
* @param {boolean} [update=false] do we update the current share ?
584+
* @param {boolean} [update] do we update the current share ?
675585
*/
676586
async pushNewLinkShare(share, update) {
677587
try {
@@ -748,26 +658,6 @@ export default {
748658
this.loading = false
749659
}
750660
},
751-
752-
/**
753-
* Label changed, let's save it to a different key
754-
*
755-
* @param {string} label the share label
756-
*/
757-
onLabelChange(label) {
758-
this.$set(this.share, 'newLabel', label.trim())
759-
},
760-
761-
/**
762-
* When the note change, we trim, save and dispatch
763-
*/
764-
onLabelSubmit() {
765-
if (typeof this.share.newLabel === 'string') {
766-
this.share.label = this.share.newLabel
767-
this.$delete(this.share, 'newLabel')
768-
this.queueUpdate('label')
769-
}
770-
},
771661
async copyLink() {
772662
try {
773663
await navigator.clipboard.writeText(this.shareLink)
@@ -870,6 +760,10 @@ export default {
870760
// YET. We can safely delete the share :)
871761
this.$emit('remove:share', this.share)
872762
},
763+
764+
toggleQuickShareSelect() {
765+
this.showDropdown = !this.showDropdown
766+
},
873767
},
874768
}
875769
</script>
@@ -879,13 +773,13 @@ export default {
879773
display: flex;
880774
align-items: center;
881775
min-height: 44px;
776+
882777
&__desc {
883778
display: flex;
884779
flex-direction: column;
885780
justify-content: space-between;
886781
padding: 8px;
887782
line-height: 1.2em;
888-
overflow: hidden;
889783
890784
p {
891785
color: var(--color-text-maxcontrast);

0 commit comments

Comments
 (0)