diff --git a/changelog/unreleased/bugfix-invite people-password-protected-folder b/changelog/unreleased/bugfix-invite people-password-protected-folder new file mode 100644 index 00000000000..6383d8b2322 --- /dev/null +++ b/changelog/unreleased/bugfix-invite people-password-protected-folder @@ -0,0 +1,7 @@ +Bugfix: Enabling "invite people" for password-protected folder/file + +Enables selecting "invite people" for password-protected folder/file. +Selecting this permission will drop password protection and expiration date. + +https://github.com/owncloud/web/pull/9931 +https://github.com/owncloud/web/issues/9922 diff --git a/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue b/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue index 621a8156a26..47d4903308d 100644 --- a/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue +++ b/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue @@ -444,7 +444,14 @@ export default defineComponent({ }, checkLinkToUpdate({ link }) { - const params = this.getParamsForLink(link) + let params = this.getParamsForLink(link) + if (link.permissions === 0) { + params = { + ...params, + password: '', + expireDate: '' + } + } if (!link.password && !this.canDeletePublicLinkPassword(link)) { showQuickLinkPasswordModal( @@ -630,7 +637,6 @@ export default defineComponent({ this.hasPublicLinkEditing, this.hasPublicLinkContribute, this.hasPublicLinkAliasSupport, - !!link.password, this.canCreatePublicLinks ) } @@ -640,7 +646,6 @@ export default defineComponent({ this.hasPublicLinkEditing, this.hasPublicLinkContribute, this.hasPublicLinkAliasSupport, - !!link.password, this.canCreatePublicLinks ) } diff --git a/packages/web-client/src/helpers/share/role.ts b/packages/web-client/src/helpers/share/role.ts index 08e51ec3eb0..2d398304351 100644 --- a/packages/web-client/src/helpers/share/role.ts +++ b/packages/web-client/src/helpers/share/role.ts @@ -377,11 +377,10 @@ export abstract class LinkShareRoles { canEditFile = false, canContribute = false, hasAliasLinks = false, - hasPassword = false, canCreatePublicLinks = true ): ShareRole[] { return [ - ...(hasAliasLinks && !hasPassword ? [linkRoleInternalFile, linkRoleInternalFolder] : []), + ...(hasAliasLinks ? [linkRoleInternalFile, linkRoleInternalFolder] : []), ...(canCreatePublicLinks ? [linkRoleViewerFile] : []), ...(canCreatePublicLinks ? [linkRoleViewerFolder] : []), ...(canCreatePublicLinks && canContribute ? [linkRoleContributorFolder] : []), @@ -392,7 +391,7 @@ export abstract class LinkShareRoles { } static getByBitmask(bitmask: number, isFolder: boolean): ShareRole { - return this.list(isFolder, true, true, true, false).find((r) => r.bitmask(false) === bitmask) + return this.list(isFolder, true, true, true, true).find((r) => r.bitmask(false) === bitmask) } /** @@ -402,7 +401,6 @@ export abstract class LinkShareRoles { * @param canEditFile * @param canContribute * @param hasAliasLinks - * @param hasPassword * @param canCreatePublicLinks */ static filterByBitmask( @@ -411,7 +409,6 @@ export abstract class LinkShareRoles { canEditFile = false, canContribute = false, hasAliasLinks = false, - hasPassword = false, canCreatePublicLinks = true ): ShareRole[] { return this.list( @@ -419,7 +416,6 @@ export abstract class LinkShareRoles { canEditFile, canContribute, hasAliasLinks, - hasPassword, canCreatePublicLinks ).filter((r) => { return bitmask === (bitmask | r.bitmask(false)) diff --git a/packages/web-client/tests/unit/helpers/share/role.spec.ts b/packages/web-client/tests/unit/helpers/share/role.spec.ts index 883a154f652..9ebdb56383d 100644 --- a/packages/web-client/tests/unit/helpers/share/role.spec.ts +++ b/packages/web-client/tests/unit/helpers/share/role.spec.ts @@ -239,7 +239,7 @@ describe('roles', () => { } ] ])('%s', (name: string, { folder, result }) => { - expect(LinkShareRoles.list(folder, true, true, true, false)).toEqual(result) + expect(LinkShareRoles.list(folder, true, true, true, true)).toEqual(result) }) }) describe('getByBitmask', () => {