mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-25 11:48:45 +00:00
Add ability to hide comments on levels and profiles
This commit is contained in:
parent
0b8c0cbfb4
commit
8fe9bd4c57
12 changed files with 123 additions and 16 deletions
|
@ -28,13 +28,16 @@ public class NewCasePage : BaseLayout
|
|||
return this.Page();
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPost(CaseType? type, string reason, string modNotes, DateTime expires, int? affectedId)
|
||||
public async Task<IActionResult> OnPost(CaseType? type, string? reason, string? modNotes, DateTime expires, int? affectedId)
|
||||
{
|
||||
User? user = this.Database.UserFromWebRequest(this.Request);
|
||||
if (user == null || !user.IsModerator) return this.Redirect("/login");
|
||||
|
||||
if (type == null) return this.BadRequest();
|
||||
if (affectedId == null) return this.BadRequest();
|
||||
|
||||
reason ??= string.Empty;
|
||||
modNotes ??= string.Empty;
|
||||
|
||||
// this is fucking ugly
|
||||
// if id is invalid then return bad request
|
||||
|
|
|
@ -223,7 +223,7 @@
|
|||
</div>
|
||||
</a>
|
||||
|
||||
@if (!(bool)Model.Slot?.Hidden)
|
||||
@if (!Model.Slot!.Hidden)
|
||||
{
|
||||
<a href="/moderation/newCase?type=@((int)CaseType.LevelHide)&affectedId=@Model.Slot?.SlotId">
|
||||
<div class="ui yellow button">
|
||||
|
@ -232,5 +232,13 @@
|
|||
</div>
|
||||
</a>
|
||||
}
|
||||
|
||||
@if (Model.Slot!.CommentsEnabled)
|
||||
{
|
||||
<a class="ui yellow button" href="/moderation/newCase?type=@((int)CaseType.LevelDisableComments)&affectedId=@Model.Slot?.SlotId">
|
||||
<i class="lock icon"></i>
|
||||
<span>Disable Comments</span>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
}
|
|
@ -17,7 +17,7 @@ public class SlotPage : BaseLayout
|
|||
public List<Review> Reviews = new();
|
||||
public List<Photo> Photos = new();
|
||||
|
||||
public readonly bool CommentsEnabled = ServerConfiguration.Instance.UserGeneratedContentLimits.LevelCommentsEnabled;
|
||||
public bool CommentsEnabled;
|
||||
public readonly bool ReviewsEnabled = ServerConfiguration.Instance.UserGeneratedContentLimits.LevelReviewsEnabled;
|
||||
|
||||
public Slot? Slot;
|
||||
|
@ -58,6 +58,7 @@ public class SlotPage : BaseLayout
|
|||
|
||||
this.Slot = slot;
|
||||
|
||||
this.CommentsEnabled = ServerConfiguration.Instance.UserGeneratedContentLimits.LevelCommentsEnabled && this.Slot.CommentsEnabled;
|
||||
if (this.CommentsEnabled)
|
||||
{
|
||||
this.Comments = await this.Database.Comments.Include(p => p.Poster)
|
||||
|
|
|
@ -132,6 +132,17 @@
|
|||
<div class="ui fitted hidden divider"></div>
|
||||
}
|
||||
|
||||
@if (Model.ProfileUser.CommentsEnabled)
|
||||
{
|
||||
<div>
|
||||
<a class="ui yellow button" href="/moderation/newCase?type=@((int)CaseType.UserDisableComments)&affectedId=@Model.ProfileUser.UserId">
|
||||
<i class="lock icon"></i>
|
||||
<span>Disable Comments</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="ui fitted hidden divider"></div>
|
||||
}
|
||||
|
||||
<div>
|
||||
<a class="ui red button" href="/moderation/user/@Model.ProfileUser.UserId/wipePlanets">
|
||||
<i class="trash alternate icon"></i>
|
||||
|
|
|
@ -13,7 +13,7 @@ public class UserPage : BaseLayout
|
|||
{
|
||||
public List<Comment>? Comments;
|
||||
|
||||
public bool CommentsEnabled = ServerConfiguration.Instance.UserGeneratedContentLimits.ProfileCommentsEnabled;
|
||||
public bool CommentsEnabled;
|
||||
|
||||
public bool IsProfileUserHearted;
|
||||
|
||||
|
@ -51,7 +51,9 @@ public class UserPage : BaseLayout
|
|||
}
|
||||
|
||||
this.Photos = await this.Database.Photos.Include(p => p.Slot).OrderByDescending(p => p.Timestamp).Where(p => p.CreatorId == userId).Take(6).ToListAsync();
|
||||
if (this.CommentsEnabled)
|
||||
|
||||
this.CommentsEnabled = ServerConfiguration.Instance.UserGeneratedContentLimits.LevelCommentsEnabled && this.ProfileUser.CommentsEnabled;
|
||||
if(this.CommentsEnabled)
|
||||
{
|
||||
this.Comments = await this.Database.Comments.Include(p => p.Poster)
|
||||
.OrderByDescending(p => p.Timestamp)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue