Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
BugFix: Setting of granular permissions changed
Ashish Viradiya64f6daf10cb4
diff --git a/components/links/links-table.tsx b/components/links/links-table.tsxindex c6cc29f5..604bedcc 100644--- a/components/links/links-table.tsx+++ b/components/links/links-table.tsx@@ -326,6 +326,13 @@ export default function LinksTable({`/api/teams/${teamInfo?.currentTeam?.id}/${endpointTargetType}/${encodeURIComponent(targetId,)}/links`,+ (currentLinks: LinkWithViews[] | undefined) =>+ (currentLinks || []).map((link: LinkWithViews) =>+ link.id === editPermissionLink.id+ ? { ...link, permissionGroupId: null }+ : link,+ ),+ false,);// Invalidate the permission group cachediff --git a/ee/features/permissions/components/dataroom-link-sheet.tsx b/ee/features/permissions/components/dataroom-link-sheet.tsxindex 3a78dab8..cd1251b4 100644--- a/ee/features/permissions/components/dataroom-link-sheet.tsx+++ b/ee/features/permissions/components/dataroom-link-sheet.tsx@@ -220,6 +220,7 @@ export function DataroomLinkSheet({permissions,false,true,+ true,);// Close the sheets and show success@@ -237,6 +238,7 @@ export function DataroomLinkSheet({permissions: ItemPermission | null,shouldPreview: boolean = false,showSuccess: boolean = false,+ isPermissionUpdate: boolean = false,) => {// Upload the image if it's a data URLlet blobUrl: string | null =@@ -297,7 +299,12 @@ export function DataroomLinkSheet({const returnedLink = await response.json();// Handle permissions- if (permissions === null && isUpdating && currentLink?.permissionGroupId) {+ if (+ isPermissionUpdate &&+ permissions === null &&+ isUpdating &&+ currentLink?.permissionGroupId+ ) {// Delete the permission group - database will set permissionGroupId to null automaticallyconst deleteResponse = await fetch(`/api/teams/${teamInfo?.currentTeam?.id}/datarooms/${targetId}/permission-groups/${currentLink.permissionGroupId}`,@@ -318,6 +325,8 @@ export function DataroomLinkSheet({return;}+ returnedLink.permissionGroupId = null;+// Show success messagetoast.success("Permission group deleted successfully");@@ -335,7 +344,7 @@ export function DataroomLinkSheet({false,);} else if (permissions !== null) {- // Only handle permission group operations if we're not deleting+ // Only handle permission group operations if we have specific permissions to setawait handlePermissionGroupOperations(returnedLink,permissions,@@ -569,6 +578,7 @@ export function DataroomLinkSheet({permissions,shouldPreview,showSuccess,+ false,);};