Skip to content

Commit

Permalink
Add button and controller to remove user avatar
Browse files Browse the repository at this point in the history
  • Loading branch information
FeTetra committed Sep 2, 2024
1 parent 0af064a commit ba1ea9c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,22 @@ public async Task<IActionResult> WipeScores([FromRoute] int id)
}

/// <summary>
/// Forces the email verification of a user.
/// Deletes the user's current avatar. Can prevent crashes in-game, or just be used to remove images that break guidelines.
/// </summary>
[HttpGet("wipeAvatar")]
public async Task<IActionResult> WipeAvatar([FromRoute] int id)
{
UserEntity? user = this.database.UserFromWebRequest(this.request);
if (user == null || !user.IsModerator) return this.NotFound();

UserEntity? targetedUser = await this.database.Users.FirstOrDefaultAsync(u => u.UserId == id);
if (targetedUser == null) return this.NotFound();

targetedUser.IconHash = "";
}

/// <summary>
/// Forces the email verification of a user.
/// </summary>
[HttpGet("forceVerifyEmail")]
public async Task<IActionResult> ForceVerifyEmail([FromRoute] int id)
Expand Down
5 changes: 5 additions & 0 deletions ProjectLighthouse.Servers.Website/Pages/UserPage.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,11 @@ else
<span>Wipe User&apos;s Scores</span>
</a>

<a class="ui yellow button" href="/moderation/user/@Model.ProfileUser.UserId/wipeAvatar">
<i class="trash alternate icon"></i>
<span>Remove User Avatar</span>
</a>

@if (!Model.CommentsDisabledByModerator)
{
<a class="ui yellow button" href="/moderation/newCase?type=@((int)CaseType.UserDisableComments)&affectedId=@Model.ProfileUser.UserId">
Expand Down

0 comments on commit ba1ea9c

Please sign in to comment.