Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Unable to select group viewing permissions #9541

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/app/src/server/routes/apiv3/page/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ module.exports = (crowi) => {
} = page;
let isGrantNormalized = false;
try {
const grantedUsersId = grantedUsers.map(ref => getIdForRef(ref));
const grantedUsersId = grantedUsers?.map(ref => getIdForRef(ref));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

バグの原因は page.grantedUsers が null の時に null 許容の実装になっていないことから 500 エラーが返却されることが原因だった。

@growi/app:dev: 02:28:35.201Z ERROR growi:routes:apiv3:page:
@growi/app:dev:   Error occurred while processing isGrantNormalized. TypeError: Cannot read properties of null (reading 'map')
@growi/app:dev:       at /workspace/growi/apps/app/src/server/routes/apiv3/page/index.ts:533:43
@growi/app:dev:       at processTicksAndRejections (node:internal/process/task_queues:95:5)
@growi/app:dev: GET /_api/v3/page/grant-data?pageId=62a1a77c6efd10033d9504cb 500 7.355 ms - 85

isGrantNormalized = await pageGrantService.isGrantNormalized(req.user, path, grant, grantedUsersId, grantedGroups, false, false);
}
catch (err) {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/interfaces/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export type IPage = {
descendantCount: number,
isEmpty: boolean,
grant: PageGrant,
grantedUsers: Ref<IUser>[],
grantedUsers?: Ref<IUser>[],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null 許容型に変更

grantedGroups: IGrantedGroup[],
lastUpdateUser?: Ref<IUser>,
liker: Ref<IUser>[],
Expand Down
Loading