feat: ban message now shows the ban reason and time when unbanned

Signed-off-by: limited_dev <loginakkisativ@gmail.com>
This commit is contained in:
limited_dev 2023-06-13 19:08:43 +02:00
parent bc1d632e4c
commit 3abc1ba7ab
4 changed files with 26 additions and 5 deletions

View file

@ -1,6 +1,7 @@
@using System.ComponentModel.DataAnnotations
@using ImageBoardServerApp.Auth
@using ImageBoardServerApp.Data.Repository
@using ImageBoardServerApp.Util
@inject NavigationManager navigationManager
@inject IWebHostEnvironment env
@inject AuthenticationStateProvider authStateProvider
@ -110,6 +111,12 @@
postErr = "You are not logged in.";
return;
}
if (!foundusr.ConfirmedEmail)
{
hasErr = true;
postErr = "You cannot post without an verified email.";
return;
}
int userID = foundusr.UserID;
if (DateTimeOffset.Now.ToUnixTimeMilliseconds() - foundusr.TimeBanned < 0)
{
@ -118,9 +125,9 @@
if (foundusr.TimeBanned != -1)
{
var dt = TheManager.ConvertToDateTime(foundusr.TimeBanned);
hasErr = true;
postErr = "You are banned and may not comment.";
//Maybe redirect to /banned?
postErr = "You are banned for " + foundusr.BanReason + " and may not comment until " + dt.Year + "." + dt.Month + "." + dt.Day + " " + dt.Hour + ":" + dt.Minute + "::" + dt.Second;
return;
}
foundusr.lastActionTimeStamp = DateTimeOffset.Now.ToUnixTimeMilliseconds();

View file

@ -117,6 +117,12 @@
postErr = "You are not logged in.";
return;
}
if (!foundusr.ConfirmedEmail)
{
hasErr = true;
postErr = "You cannot post without an verified email.";
return;
}
int userID = foundusr.UserID;
if (DateTimeOffset.Now.ToUnixTimeMilliseconds() - foundusr.TimeBanned < 0)
{
@ -125,9 +131,9 @@
if (foundusr.TimeBanned != -1)
{
var dt = TheManager.ConvertToDateTime(foundusr.TimeBanned);
hasErr = true;
postErr = "You are banned and may not post.";
//Maybe redirect to /banned?
postErr = "You are banned for " + foundusr.BanReason + " and may not post until " + dt.Year + "." + dt.Month + "." + dt.Day + " " + dt.Hour + ":" + dt.Minute + "::" + dt.Second;
return;
}