From 11067d4f3a697a2ce22a60c7a25a6363c3e5ab3a Mon Sep 17 00:00:00 2001 From: jvyden Date: Sun, 19 Dec 2021 23:47:00 -0500 Subject: [PATCH] Dont hide banned user's profiles --- ProjectLighthouse/Pages/UserPage.cshtml | 21 ++++++++++++++------- ProjectLighthouse/Pages/UserPage.cshtml.cs | 3 +-- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/ProjectLighthouse/Pages/UserPage.cshtml b/ProjectLighthouse/Pages/UserPage.cshtml index b7843b06..382f2f40 100644 --- a/ProjectLighthouse/Pages/UserPage.cshtml +++ b/ProjectLighthouse/Pages/UserPage.cshtml @@ -12,17 +12,24 @@ Model.ShowTitleInPage = false; } -@if (Model.User != null && Model.User.IsAdmin && Model.ProfileUser.Banned) +@if (Model.ProfileUser.Banned) {

- User is banned! + User is currently banned!

-

Reason: @Model.ProfileUser.BannedReason

- - - Unban User - + @if (Model.User != null && Model.User.IsAdmin) + { +

Reason: @Model.ProfileUser.BannedReason

+ + + Unban User + + } + else + { +

For shame...

+ }
} diff --git a/ProjectLighthouse/Pages/UserPage.cshtml.cs b/ProjectLighthouse/Pages/UserPage.cshtml.cs index e903ff09..0240ab59 100644 --- a/ProjectLighthouse/Pages/UserPage.cshtml.cs +++ b/ProjectLighthouse/Pages/UserPage.cshtml.cs @@ -24,9 +24,8 @@ namespace LBPUnion.ProjectLighthouse.Pages public async Task OnGet([FromRoute] int userId) { - bool canViewBannedUsers = this.User != null && this.User.IsAdmin; this.ProfileUser = await this.Database.Users.FirstOrDefaultAsync(u => u.UserId == userId); - if (this.ProfileUser == null || !canViewBannedUsers && this.ProfileUser.Banned) return this.NotFound(); + if (this.ProfileUser == null) return this.NotFound(); this.Photos = await this.Database.Photos.OrderByDescending(p => p.Timestamp).Where(p => p.CreatorId == userId).Take(5).ToListAsync(); this.Comments = await this.Database.Comments.Include