bulletboards/ImageBoardServerApp/Shared/Components/ReportEntry.razor
limited_dev 73be698399 !INFO: tried to move to postgreSQL did not work
fix: fixed bumping, fixed banning from Reports Menu
feat: improved homepage, finilized comments and posts, moved version from nav menu to sidebar

Signed-off-by: limited_dev <loginakkisativ@gmail.com>
2023-06-13 23:34:16 +02:00

91 lines
No EOL
2.9 KiB
Text

@using System.ComponentModel.DataAnnotations
@using ImageBoardServerApp.Data.Repository
@inject NavigationManager navigationManager
<div>
@if (report.Type == "op")
{
<span> /@report.ReportedPost.Board/ </span>
}
else
{
<span> /@report.ReportedComment.Board/ </span>
}
<span>#@report.ReportID</span>
<span>@report.Type</span>
<br/>
<span>Reason: @report.ReportReason</span>
<br/>
<span>Explaination: @report.ReportExlaination</span>
<br/>
<span>Ban User: </span>
<a @onclick="() => banTarget(1)" href="javascript:void(0)">1h</a>
<span> </span>
<a @onclick="() => banTarget(2)" href="javascript:void(0)">2h</a>
<span> </span>
<a @onclick="() => banTarget(1 * 24)" href="javascript:void(0)">1d</a>
<span> </span>
<a @onclick="() => banTarget(7 * 24)" href="javascript:void(0)">1w</a>
<span> </span>
<a @onclick="() => banTarget(31 * 24)" href="javascript:void(0)">1m</a>
<span> </span>
<a @onclick="() => banTarget(365 * 24)" href="javascript:void(0)">1yr</a>
<span> </span>
<br/>
<span>Ban Reporter: </span>
<a @onclick="() => banReporter(1)" href="javascript:void(0)">1h</a>
<span> </span>
<a @onclick="() => banReporter(2)" href="javascript:void(0)">2h</a>
<span> </span>
<a @onclick="() => banReporter(1 * 24)" href="javascript:void(0)">1d</a>
<span> </span>
<a @onclick="() => banReporter(7 * 24)" href="javascript:void(0)">1w</a>
<span> </span>
<a @onclick="() => banReporter(31 * 24)" href="javascript:void(0)">1m</a>
<span> </span>
<a @onclick="() => banReporter(365 * 24)" href="javascript:void(0)">1yr</a>
<span> </span>
<br/>
<a @onclick="@removeReport" href="javascript:void(0)">Done</a>
<br/>
@if (report.Type == "op")
{
<Post post="report.ReportedPost" showOpenThread="true"></Post>
}
else
{
<Comment comment="report.ReportedComment"></Comment>
}
</div>
@code {
[Parameter]
[Required]
public ReportData report { get; set; }
private async Task banTarget(int days)
{
UserData user = report.UserReported;
user.TimeBanned = DateTimeOffset.Now.ToUnixTimeMilliseconds() + (days * 3600000);
user.BanReason = report.ReportReason;
await UsersRepository.updateUserAsync(user);
await removeReport();
}
private async Task banReporter(int days)
{
UserData user = report.UserReporter;
user.TimeBanned = DateTimeOffset.Now.ToUnixTimeMilliseconds() + (days * 3600000);
user.BanReason = "misuse of the report system";
await UsersRepository.updateUserAsync(user);
await removeReport();
}
private async Task removeReport()
{
await ReportsRepository.deleteReportAsync(report.ReportID);
navigationManager.NavigateTo("/sys/click/red/_sys_modmenu_reports", true, true);
}
}