Skip to content

Commit

Permalink
Merge pull request #38164 from nextcloud/show-pending-popover-menu-wh…
Browse files Browse the repository at this point in the history
…en-password-is-enabled-by-default

Show pending popover menu when password is enabled by default
  • Loading branch information
nickvergessen committed May 22, 2023
2 parents fdf7fd4 + 9f8fa48 commit f74143b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
20 changes: 10 additions & 10 deletions apps/files_sharing/src/components/SharingEntryLink.vue
Expand Up @@ -47,7 +47,7 @@
</NcActions>

<!-- pending actions -->
<NcActions v-if="!pending && (pendingPassword || pendingExpirationDate)"
<NcActions v-if="!pending && (pendingPassword || pendingEnforcedPassword || pendingExpirationDate)"
class="sharing-entry__actions"
:aria-label="actionsTooltip"
menu-align="right"
Expand All @@ -64,18 +64,18 @@
</NcActionText>

<!-- password -->
<NcActionText v-if="pendingPassword" icon="icon-password">
<NcActionText v-if="pendingEnforcedPassword" icon="icon-password">
{{ t('files_sharing', 'Password protection (enforced)') }}
</NcActionText>
<NcActionCheckbox v-else-if="config.enableLinkPasswordByDefault"
<NcActionCheckbox v-else-if="pendingPassword"
:checked.sync="isPasswordProtected"
:disabled="config.enforcePasswordForPublicLink || saving"
class="share-link-password-checkbox"
@uncheck="onPasswordDisable">
{{ t('files_sharing', 'Password protection') }}
</NcActionCheckbox>

<NcActionInput v-if="pendingPassword || share.password"
<NcActionInput v-if="pendingEnforcedPassword || share.password"
class="share-link-password"
:value.sync="share.password"
:disabled="saving"
Expand Down Expand Up @@ -517,6 +517,9 @@ export default {
* @return {boolean}
*/
pendingPassword() {
return this.config.enableLinkPasswordByDefault && this.share && !this.share.id
},
pendingEnforcedPassword() {
return this.config.enforcePasswordForPublicLink && this.share && !this.share.id
},
pendingExpirationDate() {
Expand Down Expand Up @@ -613,12 +616,9 @@ export default {
// expiration is the share object key, not expireDate
shareDefaults.expiration = this.formatDateToString(this.config.defaultExpirationDate)
}
if (this.config.enableLinkPasswordByDefault) {
shareDefaults.password = await GeneratePassword()
}
// do not push yet if we need a password or an expiration date: show pending menu
if (this.config.enforcePasswordForPublicLink || this.config.isDefaultExpireDateEnforced) {
if (this.config.enableLinkPasswordByDefault || this.config.enforcePasswordForPublicLink || this.config.isDefaultExpireDateEnforced) {
this.pending = true
// if a share already exists, pushing it
Expand All @@ -641,8 +641,8 @@ export default {
}
// ELSE, show the pending popovermenu
// if password enforced, pre-fill with random one
if (this.config.enforcePasswordForPublicLink) {
// if password default or enforced, pre-fill with random one
if (this.config.enableLinkPasswordByDefault || this.config.enforcePasswordForPublicLink) {
shareDefaults.password = await GeneratePassword()
}
Expand Down
4 changes: 2 additions & 2 deletions dist/files_sharing-files_sharing_tab.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

0 comments on commit f74143b

Please sign in to comment.