feat: Restrict Comments on Posts in Groups
Created by: Mogge

Pullrequest

Ensure that no posts in groups can be commented by users that are not member of the group.
Issues
- relates #5462 (closed)
Todo
-
None
Merge request reports
Activity
Filter activity
250 250 }) 251 251 252 const canCommentPost = rule({ 253 cache: 'no_cache', 254 })(async (_parent, args, { user, driver }) => { 255 if (!(user && user.id)) return false 256 const { postId } = args 257 const userId = user.id 258 const session = driver.session() 259 const readTxPromise = session.readTransaction(async (transaction) => { 260 const transactionResponse = await transaction.run( 261 ` 262 MATCH (post:Post { id: $postId }) 263 OPTIONAL MATCH (post)-[:IN]->(group:Group) 264 OPTIONAL MATCH (user:User { id: $userId })-[membership:MEMBER_OF]->(group) 265 RETURN group AS group, membership AS membership Created by: Tirokk
Review: Approved
Hey @Mogge Very nice that you did this !!!
What I have found is:
- with this in the webapp I can comment on a post of a public group, but get an error from the backend if I submit the comment
In my eyes:
- If commenting a post in a public group shall be possible …
- we have to adjust the backend
- If commenting a post in a public group shall not be possible …
- we have to disable the commenting funktionallity on the post
- and should display the reason why this is not possible
- making a followup issue?
Please register or sign in to reply