mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-31 09:18:38 +00:00
Dont hide banned user's profiles
This commit is contained in:
parent
2ca80bf8fd
commit
11067d4f3a
2 changed files with 15 additions and 9 deletions
|
@ -12,17 +12,24 @@
|
|||
Model.ShowTitleInPage = false;
|
||||
}
|
||||
|
||||
@if (Model.User != null && Model.User.IsAdmin && Model.ProfileUser.Banned)
|
||||
@if (Model.ProfileUser.Banned)
|
||||
{
|
||||
<div class="ui inverted red segment">
|
||||
<p>
|
||||
<b>User is banned!</b>
|
||||
<b>User is currently banned!</b>
|
||||
</p>
|
||||
<p>Reason: @Model.ProfileUser.BannedReason</p>
|
||||
<a class="ui inverted button" href="/admin/user/@Model.ProfileUser.UserId/unban">
|
||||
<i class="ban icon"></i>
|
||||
<span>Unban User</span>
|
||||
</a>
|
||||
@if (Model.User != null && Model.User.IsAdmin)
|
||||
{
|
||||
<p>Reason: @Model.ProfileUser.BannedReason</p>
|
||||
<a class="ui inverted button" href="/admin/user/@Model.ProfileUser.UserId/unban">
|
||||
<i class="ban icon"></i>
|
||||
<span>Unban User</span>
|
||||
</a>
|
||||
}
|
||||
else
|
||||
{
|
||||
<p>For shame...</p>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
|
|
|
@ -24,9 +24,8 @@ namespace LBPUnion.ProjectLighthouse.Pages
|
|||
|
||||
public async Task<IActionResult> 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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue