Revert slug hotfix and change comment links to use relative urls

This commit is contained in:
Slendy 2023-10-30 15:53:51 -05:00
commit 48a4202ba1
No known key found for this signature in database
GPG key ID: 7288D68361B91428
3 changed files with 5 additions and 8 deletions

View file

@ -18,7 +18,7 @@ using Microsoft.EntityFrameworkCore;
namespace LBPUnion.ProjectLighthouse.Servers.Website.Controllers; namespace LBPUnion.ProjectLighthouse.Servers.Website.Controllers;
[ApiController] [ApiController]
[Route("slot/{id:int}/{slug?}")] [Route("slot/{id:int}")]
public class SlotPageController : ControllerBase public class SlotPageController : ControllerBase
{ {
private readonly DatabaseContext database; private readonly DatabaseContext database;

View file

@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore;
namespace LBPUnion.ProjectLighthouse.Servers.Website.Controllers; namespace LBPUnion.ProjectLighthouse.Servers.Website.Controllers;
[ApiController] [ApiController]
[Route("user/{id:int}/{slug?}")] [Route("user/{id:int}")]
public class UserPageController : ControllerBase public class UserPageController : ControllerBase
{ {
private readonly DatabaseContext database; private readonly DatabaseContext database;

View file

@ -31,7 +31,7 @@
@if (Model.CommentsEnabled && Model.User != null) @if (Model.CommentsEnabled && Model.User != null)
{ {
<div class="ui divider"></div> <div class="ui divider"></div>
<form class="ui reply form" action="@Url.RouteUrl(ViewContext.RouteData.Values)/postComment" method="post"> <form class="ui reply form" action="postComment" method="post">
<div class="field"> <div class="field">
<textarea style="min-height: 70px; height: 70px; max-height:120px" maxlength="100" name="msg"></textarea> <textarea style="min-height: 70px; height: 70px; max-height:120px" maxlength="100" name="msg"></textarea>
</div> </div>
@ -52,9 +52,6 @@
DateTimeOffset timestamp = DateTimeOffset.FromUnixTimeSeconds(comment.Timestamp / 1000).ToLocalTime(); DateTimeOffset timestamp = DateTimeOffset.FromUnixTimeSeconds(comment.Timestamp / 1000).ToLocalTime();
string decodedMessage = HttpUtility.HtmlDecode(comment.GetCommentMessage(Database)); string decodedMessage = HttpUtility.HtmlDecode(comment.GetCommentMessage(Database));
string? url = Url.RouteUrl(ViewContext.RouteData.Values);
if (url == null) continue;
int rating = comment.ThumbsUp - comment.ThumbsDown; int rating = comment.ThumbsUp - comment.ThumbsDown;
@ -67,11 +64,11 @@
} }
} }
<div class="voting" style="@(style)"> <div class="voting" style="@(style)">
<a href="@url/rateComment?commentId=@(comment.CommentId)&rating=@(yourThumb == 1 ? 0 : 1)"> <a href="rateComment?commentId=@(comment.CommentId)&rating=@(yourThumb == 1 ? 0 : 1)">
<i class="fitted @(yourThumb == 1 ? "green" : "grey") arrow up link icon" style="display: block"></i> <i class="fitted @(yourThumb == 1 ? "green" : "grey") arrow up link icon" style="display: block"></i>
</a> </a>
<span style="text-align: center; margin: auto; @(rating < 0 ? "margin-left: -5px" : "")">@(rating)</span> <span style="text-align: center; margin: auto; @(rating < 0 ? "margin-left: -5px" : "")">@(rating)</span>
<a href="@url/rateComment?commentId=@(comment.CommentId)&rating=@(yourThumb == -1 ? 0 : -1)"> <a href="rateComment?commentId=@(comment.CommentId)&rating=@(yourThumb == -1 ? 0 : -1)">
<i class="fitted @(yourThumb == -1 ? "red" : "grey") arrow down link icon" style="display: block"></i> <i class="fitted @(yourThumb == -1 ? "red" : "grey") arrow down link icon" style="display: block"></i>
</a> </a>
</div> </div>