From 1ae3524ebbfc99806c0d964f0e5a526aab7d3716 Mon Sep 17 00:00:00 2001 From: lareii Date: Sun, 8 Sep 2024 00:43:11 +0300 Subject: [PATCH] feat: add admin role check for deletions --- client/components/app/Comment/Dropdown.jsx | 2 +- client/components/app/Post/Dropdown.jsx | 2 +- server/handlers/comments/delete_comment.go | 8 +++++--- server/handlers/posts/delete_post.go | 8 +++++--- server/models/user.go | 4 ++-- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/client/components/app/Comment/Dropdown.jsx b/client/components/app/Comment/Dropdown.jsx index e789461..f7de502 100644 --- a/client/components/app/Comment/Dropdown.jsx +++ b/client/components/app/Comment/Dropdown.jsx @@ -49,7 +49,7 @@ export default function Dropdown({ comment, setComment, onDelete }) { return ( - {user.id === comment.author.id && ( + {(user.id === comment.author.id || user.role === 'admin' ) && (