Skip to content

Commit

Permalink
Updates to sharing flow
Browse files Browse the repository at this point in the history
- Show enforced expiry date for new shares.
- Improve quick share dropdown visibility in dark mode.
- Prevent expiry date from showing expire for incoming shares.
by updating the check for `share.passwordExpirationTime` to equally
check for `undefined`.
- Move "Download permission/attribute" from custom setting (as it is just
another advanced setting and not an actual permission).
- Show correct text for upload/editing when "allow public uploads" is enabled
or disabled by admin.

Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
  • Loading branch information
Fenn-CS committed Sep 26, 2023
1 parent d395fa8 commit bfcaddd
Show file tree
Hide file tree
Showing 98 changed files with 180 additions and 167 deletions.
Expand Up @@ -238,6 +238,7 @@ export default {
background-color: var(--color-main-background);
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
border: 1px solid var(--color-border);
padding: 4px 0;
z-index: 1;
Expand All @@ -256,11 +257,11 @@ export default {
text-align: left;
&:hover {
background-color: #f2f2f2;
background-color: var(--color-background-dark);
}
&.selected {
background-color: #f0f0f0;
background-color: var(--color-background-dark);
}
}
}
Expand Down
58 changes: 28 additions & 30 deletions apps/files_sharing/src/views/SharingDetailsTab.vue
Expand Up @@ -36,7 +36,13 @@
type="radio"
button-variant-grouped="vertical"
@update:checked="toggleCustomPermissions">
{{ t('files_sharing', 'Allow upload and editing') }}
<template v-if="allowsFileDrop">
{{ t('files_sharing', 'Allow upload and editing') }}
</template>
<template v-else>
{{ t('files_sharing', 'Allow editing') }}
</template>

<template #icon>
<EditIcon :size="20" />
</template>
Expand Down Expand Up @@ -132,6 +138,9 @@
@update:checked="onPasswordProtectedByTalkChange">
{{ t('file_sharing', 'Video verification') }}
</NcCheckboxRadioSwitch>
<NcCheckboxRadioSwitch v-if="!isPublicShare" :disabled="!canSetDownload" :checked.sync="canDownload">
{{ t('file_sharing', 'Allow download') }}
</NcCheckboxRadioSwitch>
<NcCheckboxRadioSwitch :checked.sync="writeNoteToRecipientIsChecked">
{{ t('file_sharing', 'Note to recipient') }}
</NcCheckboxRadioSwitch>
Expand All @@ -142,7 +151,8 @@
{{ t('file_sharing', 'Custom permissions') }}
</NcCheckboxRadioSwitch>
<section v-if="setCustomPermissions" class="custom-permissions-group">
<NcCheckboxRadioSwitch :disabled="!allowsFileDrop && share.type === SHARE_TYPES.SHARE_TYPE_LINK" :checked.sync="hasRead">
<NcCheckboxRadioSwitch :disabled="!allowsFileDrop && share.type === SHARE_TYPES.SHARE_TYPE_LINK"
:checked.sync="hasRead">
{{ t('file_sharing', 'Read') }}
</NcCheckboxRadioSwitch>
<NcCheckboxRadioSwitch v-if="isFolder" :disabled="!canSetCreate" :checked.sync="canCreate">
Expand All @@ -151,12 +161,11 @@
<NcCheckboxRadioSwitch :disabled="!canSetEdit" :checked.sync="canEdit">
{{ t('file_sharing', 'Update') }}
</NcCheckboxRadioSwitch>
<NcCheckboxRadioSwitch v-if="config.isResharingAllowed && share.type !== SHARE_TYPES.SHARE_TYPE_LINK" :disabled="!canSetReshare" :checked.sync="canReshare">
<NcCheckboxRadioSwitch v-if="config.isResharingAllowed && share.type !== SHARE_TYPES.SHARE_TYPE_LINK"
:disabled="!canSetReshare"
:checked.sync="canReshare">
{{ t('file_sharing', 'Share') }}
</NcCheckboxRadioSwitch>
<NcCheckboxRadioSwitch v-if="!isPublicShare" :disabled="!canSetDownload" :checked.sync="canDownload">
{{ t('file_sharing', 'Download') }}
</NcCheckboxRadioSwitch>
<NcCheckboxRadioSwitch :disabled="!canSetDelete" :checked.sync="canDelete">
{{ t('file_sharing', 'Delete') }}
</NcCheckboxRadioSwitch>
Expand Down Expand Up @@ -539,7 +548,7 @@ export default {
return this.share.newPassword !== undefined
},
passwordExpirationTime() {
if (this.share.passwordExpirationTime === null) {
if (!this.isValidShareAttribute(this.share.passwordExpirationTime)) {
return null
}
Expand Down Expand Up @@ -626,9 +635,6 @@ export default {
if (hasPermissions(this.share.permissions, ATOMIC_PERMISSIONS.SHARE)) {
perms.push('share')
}
if (this.share.hasDownloadPermission) {
perms.push('download')
}
const capitalizeFirstAndJoin = array => array.map((item, index) => index === 0 ? item[0].toUpperCase() + item.substring(1) : item).join(', ')
return capitalizeFirstAndJoin(perms)
Expand Down Expand Up @@ -673,7 +679,7 @@ export default {
}
},
expandCustomPermissions() {
if (!this.advancedSectionAccordionExpanded) {
if (!this.advancedSectionAccordionExpanded) {
this.advancedSectionAccordionExpanded = true
}
this.toggleCustomPermissions()
Expand All @@ -684,34 +690,24 @@ export default {
this.setCustomPermissions = isCustomPermissions
},
async initializeAttributes() {
let hasAdvancedAttributes = false
if (this.isNewShare) {
if (this.isPasswordEnforced && this.isPublicShare) {
this.share.newPassword = await GeneratePassword()
this.advancedSectionAccordionExpanded = true
}
if (this.hasExpirationDate) {
this.share.expireDate = this.defaultExpiryDate
this.advancedSectionAccordionExpanded = true
}
return
}
if (this.isValidShareAttribute(this.share.note)) {
this.writeNoteToRecipientIsChecked = true
hasAdvancedAttributes = true
}
if (this.isValidShareAttribute(this.share.password)) {
hasAdvancedAttributes = true
}
if (this.isValidShareAttribute(this.share.expireDate)) {
hasAdvancedAttributes = true
}
if (this.isValidShareAttribute(this.share.label)) {
hasAdvancedAttributes = true
}
if (hasAdvancedAttributes) {
if (
this.isValidShareAttribute(this.share.password)
|| this.isValidShareAttribute(this.share.expireDate)
|| this.isValidShareAttribute(this.share.label)
) {
this.advancedSectionAccordionExpanded = true
}
Expand Down Expand Up @@ -1017,6 +1013,7 @@ export default {
&__delete {
>button:first-child {
color: rgb(223, 7, 7);
background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--color-border));
}
}
Expand All @@ -1028,6 +1025,7 @@ export default {
flex-direction: column;
justify-content: space-between;
align-items: flex-start;
background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--color-primary-light));
.button-group {
display: flex;
Expand Down
2 changes: 2 additions & 0 deletions dist/3609-3609.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/3609-3609.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/50-50.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/50-50.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions dist/5903-5903.js

Large diffs are not rendered by default.

File renamed without changes.
1 change: 1 addition & 0 deletions dist/5903-5903.js.map

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions dist/5912-5912.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/5912-5912.js.map

This file was deleted.

3 changes: 0 additions & 3 deletions dist/5941-5941.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/5941-5941.js.map

This file was deleted.

2 changes: 0 additions & 2 deletions dist/6678-6678.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/6678-6678.js.map

This file was deleted.

2 changes: 2 additions & 0 deletions dist/6870-6870.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/6870-6870.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/7816-7816.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/7816-7816.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/comments-comments-app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/comments-comments-app.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/comments-init.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/comments-init.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/core-common.js

Large diffs are not rendered by default.

0 comments on commit bfcaddd

Please sign in to comment.