mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
fix: prevent admins and moderators from being reported
This commit is contained in:
@@ -657,7 +657,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{#if !isOwner && !$user?.isBanned && $user}
|
||||
{#if !isOwner && !$user?.isBanned && $user && (!hasRole(data.user.roles, roles.Admin) || !hasRole(data.user.roles, roles.Moderator))}
|
||||
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||
<div
|
||||
|
||||
@@ -360,6 +360,8 @@ namespace SharpbinV3.Server.Controllers
|
||||
return NotFound(new { success = false, message = "User not found." });
|
||||
if (reportedUser.UUID == reporter.UUID)
|
||||
return BadRequest(new { success = false, message = "You cannot report yourself." });
|
||||
if (reportedUser.Roles.HasFlag(Role.Admin) || reportedUser.Roles.HasFlag(Role.Moderator))
|
||||
return BadRequest(new { success = false, message = "You cannot report staff members." });
|
||||
Enum.TryParse<ReportType>(request.ReportType, true, out var reportType);
|
||||
if (!Enum.IsDefined(reportType))
|
||||
return BadRequest(new { success = false, message = "Invalid report type." });
|
||||
|
||||
Reference in New Issue
Block a user