mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-05 12:51:27 +00:00
Fix logging for posting website comments
This commit is contained in:
parent
abfa53ca47
commit
6cec706792
2 changed files with 19 additions and 5 deletions
|
@ -65,7 +65,7 @@ public class SlotPageController : ControllerBase
|
||||||
|
|
||||||
if (msg == null)
|
if (msg == null)
|
||||||
{
|
{
|
||||||
Logger.Error($"Refusing to post comment from {token.UserId} on user {id}, {nameof(msg)} is null", LogArea.Comments);
|
Logger.Error($"Refusing to post comment from {token.UserId} on level {id}, {nameof(msg)} is null", LogArea.Comments);
|
||||||
return this.Redirect("~/slot/" + id);
|
return this.Redirect("~/slot/" + id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,8 +73,15 @@ public class SlotPageController : ControllerBase
|
||||||
msg = SanitizationHelper.SanitizeString(msg);
|
msg = SanitizationHelper.SanitizeString(msg);
|
||||||
msg = CensorHelper.FilterMessage(msg);
|
msg = CensorHelper.FilterMessage(msg);
|
||||||
|
|
||||||
await this.database.PostComment(token.UserId, id, CommentType.Level, msg);
|
bool success = await this.database.PostComment(token.UserId, id, CommentType.Level, msg);
|
||||||
Logger.Success($"Posted comment from {token.UserId}: \"{msg}\" on user {id}", LogArea.Comments);
|
if (success)
|
||||||
|
{
|
||||||
|
Logger.Success($"Posted comment from {token.UserId}: \"{msg}\" on level {id}", LogArea.Comments);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger.Error($"Failed to post comment from {token.UserId}: \"{msg}\" on level {id}", LogArea.Comments);
|
||||||
|
}
|
||||||
|
|
||||||
return this.Redirect("~/slot/" + id);
|
return this.Redirect("~/slot/" + id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,8 +47,15 @@ public class UserPageController : ControllerBase
|
||||||
msg = SanitizationHelper.SanitizeString(msg);
|
msg = SanitizationHelper.SanitizeString(msg);
|
||||||
msg = CensorHelper.FilterMessage(msg);
|
msg = CensorHelper.FilterMessage(msg);
|
||||||
|
|
||||||
await this.database.PostComment(token.UserId, id, CommentType.Profile, msg);
|
bool success = await this.database.PostComment(token.UserId, id, CommentType.Profile, msg);
|
||||||
Logger.Success($"Posted comment from {token.UserId}: \"{msg}\" on user {id}", LogArea.Comments);
|
if (success)
|
||||||
|
{
|
||||||
|
Logger.Success($"Posted comment from {token.UserId}: \"{msg}\" on user {id}", LogArea.Comments);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger.Error($"Failed to post comment from {token.UserId}: \"{msg}\" on user {id}", LogArea.Comments);
|
||||||
|
}
|
||||||
|
|
||||||
return this.Redirect("~/user/" + id);
|
return this.Redirect("~/user/" + id);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue