Skip to content

Commit 95c4e06

Browse files
committed
🩹(frontend) add computed_link_reach on PUT link-configuration
By default a document is "restricted", a restricted document cannot have a role "editor" or "reader". With inheritance, a child document could have a computed link reach different than "restricted" though. We pass the computed link reach when we update the link role, to be sure if follows the parent computed link reach.
1 parent 56d02f1 commit 95c4e06

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ and this project adheres to
2222

2323
- 🐛(makefile) Windows compatibility fix for Docker volume mounting #1264
2424
- 🐛(minio) fix user permission error with Minio and Windows #1264
25+
- 🐛link role update #1287
2526

2627

2728
## [3.5.0] - 2025-07-31

src/frontend/apps/e2e/__tests__/app-impress/doc-inherited-share.spec.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ test.describe('Inherited share accesses', () => {
5252
await expect(docVisibilityCard.getByText('Connected')).toBeVisible();
5353
await expect(docVisibilityCard.getByText('Reading')).toBeVisible();
5454

55+
await docVisibilityCard.getByText('Reading').click();
56+
await page.getByRole('menuitem', { name: 'Editing' }).click();
57+
58+
await expect(docVisibilityCard.getByText('Reading')).toBeHidden();
59+
await expect(docVisibilityCard.getByText('Editing')).toBeVisible();
60+
5561
// Verify inherited link
5662
await docVisibilityCard.getByText('Connected').click();
5763
await expect(
@@ -61,17 +67,13 @@ test.describe('Inherited share accesses', () => {
6167
// Update child link
6268
await page.getByRole('menuitem', { name: 'Public' }).click();
6369

64-
await docVisibilityCard.getByText('Reading').click();
65-
await page.getByRole('menuitem', { name: 'Editing' }).click();
66-
6770
await expect(docVisibilityCard.getByText('Connected')).toBeHidden();
68-
await expect(docVisibilityCard.getByText('Reading')).toBeHidden();
6971
await expect(
7072
docVisibilityCard.getByText('Public', {
7173
exact: true,
7274
}),
7375
).toBeVisible();
74-
await expect(docVisibilityCard.getByText('Editing')).toBeVisible();
76+
7577
await expect(
7678
docVisibilityCard.getByText(
7779
'The link sharing rules differ from the parent document',

src/frontend/apps/impress/src/features/docs/doc-share/components/DocVisibility.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
LinkReach,
1818
LinkRole,
1919
getDocLinkReach,
20+
getDocLinkRole,
2021
useDocUtils,
2122
useUpdateDocLink,
2223
} from '@/docs/doc-management';
@@ -36,7 +37,7 @@ export const DocVisibility = ({ doc }: DocVisibilityProps) => {
3637
const { spacingsTokens, colorsTokens } = useCunninghamTheme();
3738
const canManage = doc.abilities.accesses_manage;
3839
const docLinkReach = getDocLinkReach(doc);
39-
const docLinkRole = doc.computed_link_role ?? LinkRole.READER;
40+
const docLinkRole = getDocLinkRole(doc);
4041
const { isDesynchronized } = useDocUtils(doc);
4142
const { linkModeTranslations, linkReachChoices, linkReachTranslations } =
4243
useTranslatedShareSettings();
@@ -85,7 +86,12 @@ export const DocVisibility = ({ doc }: DocVisibilityProps) => {
8586
const isDisabled = !options.includes(key);
8687
return {
8788
label: linkModeTranslations[key],
88-
callback: () => updateDocLink({ id: doc.id, link_role: key }),
89+
callback: () =>
90+
updateDocLink({
91+
id: doc.id,
92+
link_role: key,
93+
link_reach: docLinkReach,
94+
}),
8995
isSelected: docLinkRole === key,
9096
disabled: isDisabled,
9197
};

0 commit comments

Comments
 (0)