From e0619871652fa4a3292fd3e0e1b00d4fc2478361 Mon Sep 17 00:00:00 2001 From: Slendy Date: Thu, 26 Jan 2023 19:45:20 -0600 Subject: [PATCH] Revert PRs #646 and #647 --- .gitpod.yml | 5 - .../Pages/Errors/NotFoundPage.cshtml | 4 +- .../Pages/Partials/CommentsPartial.cshtml | 121 ++++++++---------- .../Pages/UserPage.cshtml | 25 +--- .../Pages/UserPage.cshtml.cs | 3 - 5 files changed, 63 insertions(+), 95 deletions(-) delete mode 100644 .gitpod.yml diff --git a/.gitpod.yml b/.gitpod.yml deleted file mode 100644 index c63ef1ed..00000000 --- a/.gitpod.yml +++ /dev/null @@ -1,5 +0,0 @@ -image: gitpod/workspace-dotnet - -vscode: - extensions: - - muhammad-sammy.csharp diff --git a/ProjectLighthouse.Servers.Website/Pages/Errors/NotFoundPage.cshtml b/ProjectLighthouse.Servers.Website/Pages/Errors/NotFoundPage.cshtml index 906b3adf..ae9af46d 100644 --- a/ProjectLighthouse.Servers.Website/Pages/Errors/NotFoundPage.cshtml +++ b/ProjectLighthouse.Servers.Website/Pages/Errors/NotFoundPage.cshtml @@ -4,8 +4,8 @@ @{ Layout = "Layouts/BaseLayout"; Model.Title = "Not Found"; - Model.Description = "The requested page or resource could not be found."; + Model.Description = "The page was not found."; }

@Model.Description

-

You may need to sign in to view this page.

+

This may be due to a lack of permission such as not being signed in, or maybe the page just isn't there.

diff --git a/ProjectLighthouse.Servers.Website/Pages/Partials/CommentsPartial.cshtml b/ProjectLighthouse.Servers.Website/Pages/Partials/CommentsPartial.cshtml index 4c1a6c1d..9d239584 100644 --- a/ProjectLighthouse.Servers.Website/Pages/Partials/CommentsPartial.cshtml +++ b/ProjectLighthouse.Servers.Website/Pages/Partials/CommentsPartial.cshtml @@ -1,4 +1,4 @@ -@using System.Web +@using System.Web @using System.IO @using LBPUnion.ProjectLighthouse.Localization @using LBPUnion.ProjectLighthouse.PlayerData.Profiles @@ -16,27 +16,19 @@ {

There are no comments.

} - else if (Model.ProfileUser.IsBanned) - { -

Comments are disabled because the user is banned.

- } else if (!Model.CommentsEnabled) { Comments are disabled. } - else if (Model.Comments.Count >= 50) - { -

There are more than 50 comments. Displaying the newest ones.

- } else { int count = Model.Comments.Count;

There @(count == 1 ? "is" : "are") @count comment@(count == 1 ? "" : "s").

} - @if (!Model.ProfileUser.IsBanned && Model.CommentsEnabled && Model.User != null) + @if (Model.CommentsEnabled && Model.User != null) {
@@ -51,67 +43,64 @@ } } - @if (!Model.ProfileUser.IsBanned) + @for(int i = 0; i < Model.Comments.Count; i++) { - @for(int i = 0; i < Model.Comments.Count; i++) - { - Comment comment = Model.Comments[i]; - DateTimeOffset timestamp = DateTimeOffset.FromUnixTimeSeconds(comment.Timestamp / 1000).ToLocalTime(); - StringWriter messageWriter = new(); - HttpUtility.HtmlDecode(comment.getComment(), messageWriter); + Comment comment = Model.Comments[i]; + DateTimeOffset timestamp = DateTimeOffset.FromUnixTimeSeconds(comment.Timestamp / 1000).ToLocalTime(); + StringWriter messageWriter = new(); + HttpUtility.HtmlDecode(comment.getComment(), messageWriter); - string decodedMessage = messageWriter.ToString(); - string? url = Url.RouteUrl(ViewContext.RouteData.Values); - if (url == null) continue; + string decodedMessage = messageWriter.ToString(); + string? url = Url.RouteUrl(ViewContext.RouteData.Values); + if (url == null) continue; - int rating = comment.ThumbsUp - comment.ThumbsDown; + int rating = comment.ThumbsUp - comment.ThumbsDown; -
- @{ - string style = ""; - if (Model.User?.UserId == comment.PosterUserId) - { - style = "pointer-events: none"; - } +
+ @{ + string style = ""; + if (Model.User?.UserId == comment.PosterUserId) + { + style = "pointer-events: none"; } -
- - - - @(rating) - - - -
- -
- @await comment.Poster.ToLink(Html, ViewData, language): - @if (comment.Deleted) - { - - @decodedMessage - - } - else - { - @decodedMessage - } - @if (((Model.User?.IsModerator ?? false) || Model.User?.UserId == comment.PosterUserId || Model.User?.UserId == pageOwnerId) && !comment.Deleted) - { - - } -

- @TimeZoneInfo.ConvertTime(timestamp, timeZoneInfo).ToString("M/d/yyyy @ h:mm:ss tt") -

- @if (i != Model.Comments.Count - 1) - { -
- } -
+ } +
+ + + + @(rating) + + +
- } + +
+ @await comment.Poster.ToLink(Html, ViewData, language): + @if (comment.Deleted) + { + + @decodedMessage + + } + else + { + @decodedMessage + } + @if (((Model.User?.IsModerator ?? false) || Model.User?.UserId == comment.PosterUserId || Model.User?.UserId == pageOwnerId) && !comment.Deleted) + { + + } +

+ @TimeZoneInfo.ConvertTime(timestamp, timeZoneInfo).ToString("M/d/yyyy @ h:mm:ss tt") +

+ @if (i != Model.Comments.Count - 1) + { +
+ } +
+
} -
+ \ No newline at end of file diff --git a/ProjectLighthouse.Servers.Website/Pages/UserPage.cshtml b/ProjectLighthouse.Servers.Website/Pages/UserPage.cshtml index c1cac229..9785b060 100644 --- a/ProjectLighthouse.Servers.Website/Pages/UserPage.cshtml +++ b/ProjectLighthouse.Servers.Website/Pages/UserPage.cshtml @@ -23,21 +23,18 @@ @if (Model.ProfileUser.IsBanned) {
+

User is currently banned!

@if (Model.User != null && Model.User.IsModerator) { -

There is an active moderation case on this account.

Reason: - "@Model.ProfileUser.BannedReason"
- Case ID: - @Model.Case?.CaseId + "@Model.ProfileUser.BannedReason"

- Only you and other moderators may view the ban reason. + Note: Only you and other moderators may view the ban reason.

} else { -

This user is currently banned.

-

Users who violate our Community Guidelines will be moderated. Be sure to follow the rules!

+

For shame...

}
} @@ -271,18 +268,8 @@ } - - @if (Model.ProfileUser.IsBanned && Model.Case != null) - { -
- - - Unban User - -
- } - @if (Model.ProfileUser.CommentsEnabled && !Model.ProfileUser.IsBanned) + @if (Model.ProfileUser.CommentsEnabled) {
@@ -296,7 +283,7 @@
- Wipe User Earth Decorations + Wipe user's earth decorations
diff --git a/ProjectLighthouse.Servers.Website/Pages/UserPage.cshtml.cs b/ProjectLighthouse.Servers.Website/Pages/UserPage.cshtml.cs index 4d0fc4a0..1e32515e 100644 --- a/ProjectLighthouse.Servers.Website/Pages/UserPage.cshtml.cs +++ b/ProjectLighthouse.Servers.Website/Pages/UserPage.cshtml.cs @@ -4,7 +4,6 @@ using LBPUnion.ProjectLighthouse.Levels; using LBPUnion.ProjectLighthouse.PlayerData; using LBPUnion.ProjectLighthouse.PlayerData.Profiles; using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts; -using LBPUnion.ProjectLighthouse.Administration; using LBPUnion.ProjectLighthouse.Types; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; @@ -25,8 +24,6 @@ public class UserPage : BaseLayout public List? HeartedSlots; public List? QueuedSlots; - public ModerationCase? Case; - public User? ProfileUser; public UserPage(Database database) : base(database) {}