mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-02 10:08:39 +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;
|
Model.ShowTitleInPage = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (Model.User != null && Model.User.IsAdmin && Model.ProfileUser.Banned)
|
@if (Model.ProfileUser.Banned)
|
||||||
{
|
{
|
||||||
<div class="ui inverted red segment">
|
<div class="ui inverted red segment">
|
||||||
<p>
|
<p>
|
||||||
<b>User is banned!</b>
|
<b>User is currently banned!</b>
|
||||||
</p>
|
</p>
|
||||||
|
@if (Model.User != null && Model.User.IsAdmin)
|
||||||
|
{
|
||||||
<p>Reason: @Model.ProfileUser.BannedReason</p>
|
<p>Reason: @Model.ProfileUser.BannedReason</p>
|
||||||
<a class="ui inverted button" href="/admin/user/@Model.ProfileUser.UserId/unban">
|
<a class="ui inverted button" href="/admin/user/@Model.ProfileUser.UserId/unban">
|
||||||
<i class="ban icon"></i>
|
<i class="ban icon"></i>
|
||||||
<span>Unban User</span>
|
<span>Unban User</span>
|
||||||
</a>
|
</a>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<p>For shame...</p>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,8 @@ namespace LBPUnion.ProjectLighthouse.Pages
|
||||||
|
|
||||||
public async Task<IActionResult> OnGet([FromRoute] int userId)
|
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);
|
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.Photos = await this.Database.Photos.OrderByDescending(p => p.Timestamp).Where(p => p.CreatorId == userId).Take(5).ToListAsync();
|
||||||
this.Comments = await this.Database.Comments.Include
|
this.Comments = await this.Database.Comments.Include
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue