v3: added a roles/permissions system, added user management tab on user profile
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 42s

This commit is contained in:
khannurien
2026-06-28 06:21:23 +00:00
parent b567e390d9
commit 810faaf21a
22 changed files with 341 additions and 60 deletions

View File

@@ -4,6 +4,7 @@ import { Controller } from "react-hook-form";
import { t } from "@lingui/core/macro";
import { Plural, Trans } from "@lingui/react/macro";
import { API_URL, VALIDATION } from "../config/api.ts";
import { can } from "../utils/permissions.ts";
import type {
Comment,
CreateCommentRequest,
@@ -234,10 +235,11 @@ function CommentNode({
setEditOpen(false);
}
const canModerate = can(currentUser, "comment:moderate");
const canDelete = !comment.deleted && !!currentUser &&
(currentUser.id === comment.userId || currentUser.isAdmin);
(currentUser.id === comment.userId || canModerate);
const canEdit = !comment.deleted && !!currentUser &&
(currentUser.id === comment.userId || currentUser.isAdmin);
(currentUser.id === comment.userId || canModerate);
if (comment.deleted) {
return (