mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-09-18 23:42:25 +00:00
Add ability to hide levels
This commit is contained in:
parent
0d7d8c25f3
commit
ef6acbb210
11 changed files with 106 additions and 32 deletions
|
@ -42,15 +42,18 @@ public class LandingPage : BaseLayout
|
|||
|
||||
const int maxShownLevels = 5;
|
||||
|
||||
this.LatestTeamPicks = await this.Database.Slots.Where
|
||||
(s => s.Type == SlotType.User)
|
||||
this.LatestTeamPicks = await this.Database.Slots.Where(s => s.Type == SlotType.User && s.Type == SlotType.User)
|
||||
.Where(s => s.TeamPick)
|
||||
.OrderByDescending(s => s.FirstUploaded)
|
||||
.Take(maxShownLevels)
|
||||
.Include(s => s.Creator)
|
||||
.ToListAsync();
|
||||
|
||||
this.NewestLevels = await this.Database.Slots.Where(s => s.Type == SlotType.User).OrderByDescending(s => s.FirstUploaded).Take(maxShownLevels).Include(s => s.Creator).ToListAsync();
|
||||
this.NewestLevels = await this.Database.Slots.Where(s => s.Type == SlotType.User && s.Type == SlotType.User)
|
||||
.OrderByDescending(s => s.FirstUploaded)
|
||||
.Take(maxShownLevels)
|
||||
.Include(s => s.Creator)
|
||||
.ToListAsync();
|
||||
|
||||
return this.Page();
|
||||
}
|
||||
|
|
|
@ -17,6 +17,18 @@
|
|||
bool isMobile = this.Request.IsMobile();
|
||||
}
|
||||
|
||||
@if (Model.Slot.Hidden)
|
||||
{
|
||||
<div class="ui inverted red segment">
|
||||
<h2>This level is currently hidden.</h2>
|
||||
<p><b>Only you and moderators may view this level.</b></p>
|
||||
|
||||
<b>Reason:</b> <span>"@Model.Slot.HiddenReason"</span>
|
||||
|
||||
<p><b>For more information please contact a moderator.</b></p>
|
||||
</div>
|
||||
}
|
||||
|
||||
@await Html.PartialAsync("Partials/SlotCardPartial", Model.Slot, new ViewDataDictionary(ViewData)
|
||||
{
|
||||
{
|
||||
|
@ -210,5 +222,15 @@
|
|||
<span>Delete</span>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
@if (!(bool)Model.Slot?.Hidden)
|
||||
{
|
||||
<a href="/moderation/newCase?type=@((int)CaseType.LevelHide)&affectedId=@Model.Slot?.SlotId">
|
||||
<div class="ui yellow button">
|
||||
<i class="lock icon"></i>
|
||||
<span>Hide</span>
|
||||
</div>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
}
|
|
@ -26,8 +26,7 @@ public class SlotPage : BaseLayout
|
|||
|
||||
public async Task<IActionResult> OnGet([FromRoute] int id)
|
||||
{
|
||||
Slot? slot = await this.Database.Slots.Include
|
||||
(s => s.Creator)
|
||||
Slot? slot = await this.Database.Slots.Include(s => s.Creator)
|
||||
.Where(s => s.Type == SlotType.User)
|
||||
.FirstOrDefaultAsync(s => s.SlotId == id);
|
||||
if (slot == null) return this.NotFound();
|
||||
|
@ -55,6 +54,8 @@ public class SlotPage : BaseLayout
|
|||
}
|
||||
}
|
||||
|
||||
if (slot.Hidden && (this.User != slot.Creator && !(bool)this.User?.IsModerator)) return this.NotFound();
|
||||
|
||||
this.Slot = slot;
|
||||
|
||||
if (this.CommentsEnabled)
|
||||
|
|
|
@ -24,12 +24,8 @@
|
|||
<b>Reason:</b>
|
||||
<span>"@Model.ProfileUser.BannedReason"</span>
|
||||
<p>
|
||||
<i>Note: Only you and other admins may view the ban reason.</i>
|
||||
<i>Note: Only you and other moderators may view the ban reason.</i>
|
||||
</p>
|
||||
<a class="ui inverted button" href="/moderation/user/@Model.ProfileUser.UserId/unban">
|
||||
<i class="ban icon"></i>
|
||||
<span>Unban User</span>
|
||||
</a>
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue