Skip to content

Commit 9e5264f

Browse files
NMC-434 - changed the process of file sharing for internal and external sharee
Signed-off-by: Yogesh Shejwadkar <yogesh.shejwadkar@t-systems.com>
1 parent d314560 commit 9e5264f

9 files changed

Lines changed: 1034 additions & 316 deletions

File tree

apps/files_sharing/src/components/SharingEntry.vue

Lines changed: 76 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,11 @@
3939
<span>{{ share.status.message || '' }}</span>
4040
</p>
4141
</component>
42-
<Actions
42+
<Actions v-if="open === false"
4343
menu-align="right"
4444
class="sharing-entry__actions"
4545
@close="onMenuClose">
46+
<<<<<<< HEAD
4647
<template v-if="share.canEdit">
4748
<!-- edit permission -->
4849
<ActionCheckbox
@@ -135,6 +136,22 @@
135136
</template>
136137
</template>
137138

139+
=======
140+
<ActionButton v-if="share.canEdit"
141+
icon="icon-settings"
142+
:disabled="saving"
143+
:share="share"
144+
@click.prevent="editPermissions">
145+
{{ t('files_sharing', 'Advanced permission') }}
146+
</ActionButton>
147+
<ActionButton v-if="share.canEdit"
148+
icon="icon-mail"
149+
:disabled="saving"
150+
:share="share"
151+
@click.prevent="editNotes">
152+
{{ t('files_sharing', 'Send new mail') }}
153+
</ActionButton>
154+
>>>>>>> e994a1f60d... NMC-434 - changed the process of file sharing for internal and external sharee
138155
<ActionButton v-if="share.canDelete"
139156
icon="icon-close"
140157
:disabled="saving"
@@ -181,10 +198,33 @@ export default {
181198
permissionsDelete: OC.PERMISSION_DELETE,
182199
permissionsRead: OC.PERMISSION_READ,
183200
permissionsShare: OC.PERMISSION_SHARE,
201+
202+
publicUploadRWValue: OC.PERMISSION_UPDATE | OC.PERMISSION_CREATE | OC.PERMISSION_READ | OC.PERMISSION_DELETE,
203+
publicUploadRValue: OC.PERMISSION_READ,
204+
publicUploadWValue: OC.PERMISSION_CREATE,
205+
publicUploadEValue: OC.PERMISSION_UPDATE | OC.PERMISSION_READ,
184206
}
185207
},
186208
187209
computed: {
210+
/**
211+
* Return the current share permissions
212+
* We always ignore the SHARE permission as this is used for the
213+
* federated sharing.
214+
* @returns {number}
215+
*/
216+
sharePermissions() {
217+
return this.share.permissions & ~OC.PERMISSION_SHARE
218+
},
219+
220+
/**
221+
* Generate a unique random id for this SharingEntry only
222+
* @returns {string}
223+
*/
224+
randomId() {
225+
return Math.random().toString(27).substr(2)
226+
},
227+
188228
title() {
189229
let title = this.share.shareWithDisplayName
190230
if (this.share.type === this.SHARE_TYPES.SHARE_TYPE_GROUP) {
@@ -348,28 +388,28 @@ export default {
348388
* Does the current share have an expiration date
349389
* @returns {boolean}
350390
*/
351-
hasExpirationDate: {
352-
get() {
353-
return this.config.isDefaultInternalExpireDateEnforced || !!this.share.expireDate
354-
},
355-
set(enabled) {
356-
this.share.expireDate = enabled
357-
? this.config.defaultInternalExpirationDateString !== ''
358-
? this.config.defaultInternalExpirationDateString
359-
: moment().format('YYYY-MM-DD')
360-
: ''
361-
},
362-
},
363-
364-
dateMaxEnforced() {
365-
if (!this.isRemote) {
366-
return this.config.isDefaultInternalExpireDateEnforced
367-
&& moment().add(1 + this.config.defaultInternalExpireDate, 'days')
368-
} else {
369-
return this.config.isDefaultRemoteExpireDateEnforced
370-
&& moment().add(1 + this.config.defaultRemoteExpireDate, 'days')
371-
}
372-
},
391+
// hasExpirationDate: {
392+
// get() {
393+
// return this.config.isDefaultInternalExpireDateEnforced || !!this.share.expireDate
394+
// },
395+
// set(enabled) {
396+
// this.share.expireDate = enabled
397+
// ? this.config.defaultInternalExpirationDateString !== ''
398+
// ? this.config.defaultInternalExpirationDateString
399+
// : moment().format('YYYY-MM-DD')
400+
// : ''
401+
// },
402+
// },
403+
404+
// dateMaxEnforced() {
405+
// if (!this.isRemote) {
406+
// return this.config.isDefaultInternalExpireDateEnforced
407+
// && moment().add(1 + this.config.defaultInternalExpireDate, 'days')
408+
// } else {
409+
// return this.config.isDefaultRemoteExpireDateEnforced
410+
// && moment().add(1 + this.config.defaultRemoteExpireDate, 'days')
411+
// }
412+
// },
373413
374414
/**
375415
* @returns {bool}
@@ -404,6 +444,18 @@ export default {
404444
onMenuClose() {
405445
this.onNoteSubmit()
406446
},
447+
448+
editPermissions() {
449+
this.$store.commit('addFromInput', false)
450+
this.$store.commit('addShare', this.share)
451+
this.$store.commit('addCurrentTab', 'permissions')
452+
},
453+
454+
editNotes() {
455+
this.$store.commit('addFromInput', false)
456+
this.$store.commit('addShare', this.share)
457+
this.$store.commit('addCurrentTab', 'notes')
458+
},
407459
},
408460
}
409461
</script>
@@ -412,7 +464,7 @@ export default {
412464
.sharing-entry {
413465
display: flex;
414466
align-items: center;
415-
height: 44px;
467+
min-height: 44px;
416468
&__desc {
417469
display: flex;
418470
flex-direction: column;

apps/files_sharing/src/components/SharingEntryLink.vue

Lines changed: 24 additions & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -131,160 +131,6 @@
131131
:open.sync="open"
132132
@close="onMenuClose">
133133
<template v-if="share">
134-
<template v-if="share.canEdit && canReshare">
135-
<!-- Custom Label -->
136-
<ActionInput
137-
ref="label"
138-
v-tooltip.auto="{
139-
content: errors.label,
140-
show: errors.label,
141-
trigger: 'manual',
142-
defaultContainer: '.app-sidebar'
143-
}"
144-
:class="{ error: errors.label }"
145-
:disabled="saving"
146-
:aria-label="t('files_sharing', 'Share label')"
147-
:value="share.newLabel !== undefined ? share.newLabel : share.label"
148-
icon="icon-edit"
149-
maxlength="255"
150-
@update:value="onLabelChange"
151-
@submit="onLabelSubmit">
152-
{{ t('files_sharing', 'Share label') }}
153-
</ActionInput>
154-
<!-- folder -->
155-
<template v-if="isFolder && fileHasCreatePermission && config.isPublicUploadEnabled">
156-
<ActionRadio :checked="sharePermissions === publicUploadRValue"
157-
:value="publicUploadRValue"
158-
:name="randomId"
159-
:disabled="saving"
160-
@change="togglePermissions">
161-
{{ t('files_sharing', 'Read only') }}
162-
</ActionRadio>
163-
<ActionRadio :checked="sharePermissions === publicUploadRWValue"
164-
:value="publicUploadRWValue"
165-
:disabled="saving"
166-
:name="randomId"
167-
@change="togglePermissions">
168-
{{ t('files_sharing', 'Allow upload and editing') }}
169-
</ActionRadio>
170-
<ActionRadio :checked="sharePermissions === publicUploadWValue"
171-
:value="publicUploadWValue"
172-
:disabled="saving"
173-
:name="randomId"
174-
class="sharing-entry__action--public-upload"
175-
@change="togglePermissions">
176-
{{ t('files_sharing', 'File drop (upload only)') }}
177-
</ActionRadio>
178-
</template>
179-
180-
<!-- file -->
181-
<ActionCheckbox v-else
182-
:checked.sync="canUpdate"
183-
:disabled="saving"
184-
@change="queueUpdate('permissions')">
185-
{{ t('files_sharing', 'Allow editing') }}
186-
</ActionCheckbox>
187-
188-
<ActionCheckbox
189-
:checked.sync="share.hideDownload"
190-
:disabled="saving"
191-
@change="queueUpdate('hideDownload')">
192-
{{ t('files_sharing', 'Hide download') }}
193-
</ActionCheckbox>
194-
195-
<!-- password -->
196-
<ActionCheckbox :checked.sync="isPasswordProtected"
197-
:disabled="config.enforcePasswordForPublicLink || saving"
198-
class="share-link-password-checkbox"
199-
@uncheck="onPasswordDisable">
200-
{{ config.enforcePasswordForPublicLink
201-
? t('files_sharing', 'Password protection (enforced)')
202-
: t('files_sharing', 'Password protect') }}
203-
</ActionCheckbox>
204-
<ActionInput v-if="isPasswordProtected"
205-
ref="password"
206-
v-tooltip.auto="{
207-
content: errors.password,
208-
show: errors.password,
209-
trigger: 'manual',
210-
defaultContainer: '#app-sidebar'
211-
}"
212-
class="share-link-password"
213-
:class="{ error: errors.password}"
214-
:disabled="saving"
215-
:required="config.enforcePasswordForPublicLink"
216-
:value="hasUnsavedPassword ? share.newPassword : '***************'"
217-
icon="icon-password"
218-
autocomplete="new-password"
219-
:type="hasUnsavedPassword ? 'text': 'password'"
220-
@update:value="onPasswordChange"
221-
@submit="onPasswordSubmit">
222-
{{ t('files_sharing', 'Enter a password') }}
223-
</ActionInput>
224-
225-
<!-- password protected by Talk -->
226-
<ActionCheckbox v-if="isPasswordProtectedByTalkAvailable"
227-
:checked.sync="isPasswordProtectedByTalk"
228-
:disabled="!canTogglePasswordProtectedByTalkAvailable || saving"
229-
class="share-link-password-talk-checkbox"
230-
@change="onPasswordProtectedByTalkChange">
231-
{{ t('files_sharing', 'Video verification') }}
232-
</ActionCheckbox>
233-
234-
<!-- expiration date -->
235-
<ActionCheckbox :checked.sync="hasExpirationDate"
236-
:disabled="config.isDefaultExpireDateEnforced || saving"
237-
class="share-link-expire-date-checkbox"
238-
@uncheck="onExpirationDisable">
239-
{{ config.isDefaultExpireDateEnforced
240-
? t('files_sharing', 'Expiration date (enforced)')
241-
: t('files_sharing', 'Set expiration date') }}
242-
</ActionCheckbox>
243-
<ActionInput v-if="hasExpirationDate"
244-
ref="expireDate"
245-
v-tooltip.auto="{
246-
content: errors.expireDate,
247-
show: errors.expireDate,
248-
trigger: 'manual',
249-
defaultContainer: '#app-sidebar'
250-
}"
251-
class="share-link-expire-date"
252-
:class="{ error: errors.expireDate}"
253-
:disabled="saving"
254-
:first-day-of-week="firstDay"
255-
:lang="lang"
256-
:value="share.expireDate"
257-
value-type="format"
258-
icon="icon-calendar-dark"
259-
type="date"
260-
:disabled-date="disabledDate"
261-
@update:value="onExpirationChange">
262-
{{ t('files_sharing', 'Enter a date') }}
263-
</ActionInput>
264-
265-
<!-- note -->
266-
<ActionCheckbox :checked.sync="hasNote"
267-
:disabled="saving"
268-
@uncheck="queueUpdate('note')">
269-
{{ t('files_sharing', 'Note to recipient') }}
270-
</ActionCheckbox>
271-
<ActionTextEditable v-if="hasNote"
272-
ref="note"
273-
v-tooltip.auto="{
274-
content: errors.note,
275-
show: errors.note,
276-
trigger: 'manual',
277-
defaultContainer: '#app-sidebar'
278-
}"
279-
:class="{ error: errors.note}"
280-
:disabled="saving"
281-
:placeholder="t('files_sharing', 'Enter a note for the share recipient')"
282-
:value="share.newNote || share.note"
283-
icon="icon-edit"
284-
@update:value="onNoteChange"
285-
@submit="onNoteSubmit" />
286-
</template>
287-
288134
<!-- external sharing via url (social...) -->
289135
<ActionLink v-for="({icon, url, name}, index) in externalActions"
290136
:key="index"
@@ -293,6 +139,18 @@
293139
target="_blank">
294140
{{ name }}
295141
</ActionLink>
142+
<ActionButton v-if="share.canEdit"
143+
icon="icon-settings"
144+
:disabled="saving"
145+
@click.prevent="editPermissions">
146+
{{ t('files_sharing', 'Advanced permission') }}
147+
</ActionButton>
148+
<ActionButton v-if="share.canEdit"
149+
icon="icon-mail"
150+
:disabled="saving"
151+
@click.prevent="editNotes">
152+
{{ t('files_sharing', 'Send new mail') }}
153+
</ActionButton>
296154

297155
<ActionButton v-if="share.canDelete"
298156
icon="icon-close"
@@ -328,10 +186,8 @@ import Vue from 'vue'
328186
329187
import ActionButton from '@nextcloud/vue/dist/Components/ActionButton'
330188
import ActionCheckbox from '@nextcloud/vue/dist/Components/ActionCheckbox'
331-
import ActionRadio from '@nextcloud/vue/dist/Components/ActionRadio'
332189
import ActionInput from '@nextcloud/vue/dist/Components/ActionInput'
333190
import ActionText from '@nextcloud/vue/dist/Components/ActionText'
334-
import ActionTextEditable from '@nextcloud/vue/dist/Components/ActionTextEditable'
335191
import ActionLink from '@nextcloud/vue/dist/Components/ActionLink'
336192
import Actions from '@nextcloud/vue/dist/Components/Actions'
337193
import Avatar from '@nextcloud/vue/dist/Components/Avatar'
@@ -348,11 +204,9 @@ export default {
348204
Actions,
349205
ActionButton,
350206
ActionCheckbox,
351-
ActionRadio,
352207
ActionInput,
353208
ActionLink,
354209
ActionText,
355-
ActionTextEditable,
356210
Avatar,
357211
},
358212
@@ -397,8 +251,6 @@ export default {
397251
},
398252
/**
399253
* Generate a unique random id for this SharingEntryLink only
400-
* This allows ActionRadios to have the same name prop
401-
* but not to impact others SharingEntryLink
402254
* @returns {string}
403255
*/
404256
randomId() {
@@ -898,8 +750,19 @@ export default {
898750
// YET. We can safely delete the share :)
899751
this.$emit('remove:share', this.share)
900752
},
901-
},
902753
754+
editPermissions() {
755+
this.$store.commit('addFromInput', false)
756+
this.$store.commit('addShare', this.share)
757+
this.$store.commit('addCurrentTab', 'permissions')
758+
},
759+
760+
editNotes() {
761+
this.$store.commit('addFromInput', false)
762+
this.$store.commit('addShare', this.share)
763+
this.$store.commit('addCurrentTab', 'notes')
764+
},
765+
},
903766
}
904767
</script>
905768

0 commit comments

Comments
 (0)