Skip to content

Commit 8ae4410

Browse files
authored
Everyone can read & create comments (#3314)
1 parent 608c399 commit 8ae4410

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

dbschema/migrations/00009-m17teec.edgeql

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Policy } from '../util';
2+
3+
@Policy('all', (r) => [
4+
// Technically, we want only when the Commentable is readable.
5+
// I think this is sufficient for practical use at this point in time.
6+
...[r.CommentThread, r.Comment].flatMap((it) => it.read.create),
7+
// This shouldn't be needed, but it is. children() needs rewrite.
8+
r.Commentable.children((c) => c.commentThreads.read.create),
9+
])
10+
export class EveryoneCanCommentPolicy {}

src/components/authorization/policies/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@ export * from './by-feature/progress-report-media-owner.policy';
2323
export * from './by-feature/project-change-requests-beta.policy';
2424
export * from './by-feature/read-util-objects.policy';
2525
export * from './by-feature/user-can-edit-self.policy';
26+
export * from './by-feature/everyone-can-comment.policy';
2627
export * from './by-feature/user-can-manage-own-comments.policy';
2728
export * from './by-feature/new-progress-reports-beta.policy';

0 commit comments

Comments
 (0)