mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-09-25 18:59:07 +00:00
Some more comment fixes
This commit is contained in:
parent
137ad2bd3a
commit
35d200502e
3 changed files with 9 additions and 9 deletions
|
@ -37,14 +37,14 @@ public class SlotPageController : ControllerBase
|
|||
}
|
||||
|
||||
[HttpGet("postComment")]
|
||||
public async Task<IActionResult> PostComment([FromRoute] int id, [FromQuery] string msg)
|
||||
public async Task<IActionResult> PostComment([FromRoute] int id, [FromQuery] string? msg)
|
||||
{
|
||||
User? user = this.database.UserFromWebRequest(this.Request);
|
||||
if (user == null) return this.Redirect("~/login");
|
||||
|
||||
bool success = await this.database.PostComment(user, id, CommentType.Level, msg);
|
||||
if (msg == null) return this.Redirect("~/slot/" + id);
|
||||
|
||||
if (!success) return this.NotFound();
|
||||
await this.database.PostComment(user, id, CommentType.Level, msg);
|
||||
|
||||
return this.Redirect("~/slot/" + id);
|
||||
}
|
||||
|
|
|
@ -35,25 +35,25 @@ public class UserPageController : ControllerBase
|
|||
}
|
||||
|
||||
[HttpGet("rateComment")]
|
||||
public async Task<IActionResult> RateComment([FromRoute] int id, [FromQuery] int commentId, [FromQuery] int rating)
|
||||
public async Task<IActionResult> RateComment([FromRoute] int id, [FromQuery] int? commentId, [FromQuery] int? rating)
|
||||
{
|
||||
User? user = this.database.UserFromWebRequest(this.Request);
|
||||
if (user == null) return this.Redirect("~/login");
|
||||
|
||||
await this.database.RateComment(user, commentId, rating);
|
||||
await this.database.RateComment(user, commentId.GetValueOrDefault(), rating.GetValueOrDefault());
|
||||
|
||||
return this.Redirect("~/user/" + id + "#" + commentId);
|
||||
}
|
||||
|
||||
[HttpGet("postComment")]
|
||||
public async Task<IActionResult> PostComment([FromRoute] int id, [FromQuery] string msg)
|
||||
public async Task<IActionResult> PostComment([FromRoute] int id, [FromQuery] string? msg)
|
||||
{
|
||||
User? user = this.database.UserFromWebRequest(this.Request);
|
||||
if (user == null) return this.Redirect("~/login");
|
||||
|
||||
bool success = await this.database.PostComment(user, id, CommentType.Profile, msg);
|
||||
if (msg == null) return this.Redirect("~/user/" + id);
|
||||
|
||||
if (!success) return this.NotFound();
|
||||
await this.database.PostComment(user, id, CommentType.Profile, msg);
|
||||
|
||||
return this.Redirect("~/user/" + id);
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
</div>
|
||||
</div>
|
||||
}
|
||||
@if(Model.CommentsEnabled){
|
||||
@if(Model.CommentsEnabled && Model.User != null){
|
||||
<div class="ui divider"></div>
|
||||
<form class="ui reply form" action="@Url.RouteUrl(ViewContext.RouteData.Values)/postComment">
|
||||
<div class="field">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue