Skip to content

Commit 27b9fa8

Browse files
committed
fix(comments): allow for users to delete their own comments on posts they did not create
1 parent 32fa3f7 commit 27b9fa8

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/generated/graphql/schema.executable.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ const spec_downvote = {
154154
},
155155
description: undefined,
156156
extensions: {
157-
oid: "230048",
157+
oid: "230322",
158158
isTableLike: true,
159159
pg: {
160160
serviceName: "main",
@@ -237,7 +237,7 @@ const spec_upvote = {
237237
},
238238
description: undefined,
239239
extensions: {
240-
oid: "229961",
240+
oid: "230235",
241241
isTableLike: true,
242242
pg: {
243243
serviceName: "main",
@@ -320,7 +320,7 @@ const spec_invitation = {
320320
},
321321
description: undefined,
322322
extensions: {
323-
oid: "230147",
323+
oid: "230421",
324324
isTableLike: true,
325325
pg: {
326326
serviceName: "main",
@@ -403,7 +403,7 @@ const spec_organization = {
403403
},
404404
description: undefined,
405405
extensions: {
406-
oid: "229923",
406+
oid: "230197",
407407
isTableLike: true,
408408
pg: {
409409
serviceName: "main",
@@ -510,7 +510,7 @@ const spec_comment = {
510510
},
511511
description: undefined,
512512
extensions: {
513-
oid: "230028",
513+
oid: "230302",
514514
isTableLike: true,
515515
pg: {
516516
serviceName: "main",
@@ -629,7 +629,7 @@ const spec_project = {
629629
},
630630
description: undefined,
631631
extensions: {
632-
oid: "229947",
632+
oid: "230221",
633633
isTableLike: true,
634634
pg: {
635635
serviceName: "main",
@@ -650,7 +650,7 @@ const roleCodec = enumCodec({
650650
values: ["owner", "admin", "member"],
651651
description: undefined,
652652
extensions: {
653-
oid: "230067",
653+
oid: "230341",
654654
pg: {
655655
serviceName: "main",
656656
schemaName: "public",
@@ -729,7 +729,7 @@ const spec_member = {
729729
},
730730
description: undefined,
731731
extensions: {
732-
oid: "229983",
732+
oid: "230257",
733733
isTableLike: true,
734734
pg: {
735735
serviceName: "main",
@@ -860,7 +860,7 @@ const spec_post = {
860860
},
861861
description: undefined,
862862
extensions: {
863-
oid: "229937",
863+
oid: "230211",
864864
isTableLike: true,
865865
pg: {
866866
serviceName: "main",
@@ -979,7 +979,7 @@ const spec_postStatus = {
979979
},
980980
description: undefined,
981981
extensions: {
982-
oid: "230121",
982+
oid: "230395",
983983
isTableLike: true,
984984
pg: {
985985
serviceName: "main",
@@ -1000,7 +1000,7 @@ const tierCodec = enumCodec({
10001000
values: ["free", "basic", "team", "enterprise"],
10011001
description: undefined,
10021002
extensions: {
1003-
oid: "230170",
1003+
oid: "230444",
10041004
pg: {
10051005
serviceName: "main",
10061006
schemaName: "public",
@@ -1129,7 +1129,7 @@ const spec_user = {
11291129
},
11301130
description: undefined,
11311131
extensions: {
1132-
oid: "229971",
1132+
oid: "230245",
11331133
isTableLike: true,
11341134
pg: {
11351135
serviceName: "main",
@@ -4128,7 +4128,7 @@ const planWrapper2 = (plan, _, fieldArgs) => {
41284128
} else {
41294129
const [currentComment] = await db.select({
41304130
organizationId: projects.organizationId,
4131-
userId: posts.userId
4131+
userId: comments.userId
41324132
}).from(comments).innerJoin(posts, eq(comments.postId, posts.id)).innerJoin(projects, eq(posts.projectId, projects.id)).where(eq(comments.id, comment));
41334133
if (currentUser.id !== currentComment.userId) {
41344134
const [userRole] = await db.select({
@@ -4422,7 +4422,7 @@ const planWrapper10 = (plan, _, fieldArgs) => {
44224422
} else {
44234423
const [currentComment] = await db.select({
44244424
organizationId: projects.organizationId,
4425-
userId: posts.userId
4425+
userId: comments.userId
44264426
}).from(comments).innerJoin(posts, eq(comments.postId, posts.id)).innerJoin(projects, eq(posts.projectId, projects.id)).where(eq(comments.id, comment));
44274427
if (currentUser.id !== currentComment.userId) {
44284428
const [userRole] = await db.select({
@@ -4742,7 +4742,7 @@ const planWrapper19 = (plan, _, fieldArgs) => {
47424742
} else {
47434743
const [currentComment] = await db.select({
47444744
organizationId: projects.organizationId,
4745-
userId: posts.userId
4745+
userId: comments.userId
47464746
}).from(comments).innerJoin(posts, eq(comments.postId, posts.id)).innerJoin(projects, eq(posts.projectId, projects.id)).where(eq(comments.id, comment));
47474747
if (currentUser.id !== currentComment.userId) {
47484748
const [userRole] = await db.select({

src/lib/plugins/postgraphile/CommentRBAC.plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const validatePermissions = (propName: string, scope: MutationScope) =>
7171
const [currentComment] = await db
7272
.select({
7373
organizationId: projects.organizationId,
74-
userId: posts.userId,
74+
userId: comments.userId,
7575
})
7676
.from(comments)
7777
.innerJoin(posts, eq(comments.postId, posts.id))

0 commit comments

Comments
 (0)