feat: added images for ban screen, added reportscreen, added reportsscreen for mods & admins

This commit is contained in:
limited_dev 2023-02-11 23:04:02 +01:00
parent 75d75a2c84
commit cb7ca62590
43 changed files with 358 additions and 46 deletions

View file

@ -37,6 +37,5 @@ public class ReportData
public string ReportReason { get; set; }
public string ReportExlaination { get; set; }
}

View file

@ -38,8 +38,8 @@ public static class ImagesRepository
public static async Task<bool> deleteImageAsync(int imageId)
{
await using var db = new AppDBContext();
ImageData imageToDelete = await getImageByIdAsync(imageId);
await using var db = new AppDBContext();
db.Remove(imageToDelete);
return await db.SaveChangesAsync() >= 1;
}

View file

@ -7,7 +7,15 @@ public static class ReportsRepository
public static async Task<List<ReportData>> getReportsAsync()
{
await using var db = new AppDBContext();
return await db.Reports.ToListAsync();
return await db.Reports
.Include(report => report.ReportedPost)
.Include(report => report.ReportedPost.Image)
.Include(report => report.ReportedPost.Comments)
.Include(report => report.ReportedComment)
.Include(report => report.ReportedComment.Image)
.Include(report => report.UserReported)
.Include(report => report.UserReporter)
.ToListAsync();
}
public static async Task<ReportData> getReportByIdAsync(int reportId)

View file

@ -0,0 +1,13 @@
namespace ImageBoardServerApp.Data;
public enum Rules
{
AGAINSTLAW,
NSFW_NSFL,
POLITICAL_CONTENT,
RAIDS,
UNDERAGE,
VPN_PROXY_TOR,
OFF_TOPIC,
OTHER,
}

View file

@ -0,0 +1,28 @@
namespace ImageBoardServerApp.Data;
public class RulesConv
{
public static Dictionary<Rules, string> dict = new Dictionary<Rules, string>()
{
{ Rules.AGAINSTLAW, "You may not post stuff that would get us into trouble with the feds." },
{ Rules.NSFW_NSFL, "You may not post NSFW / NSFL on this platform." },
{ Rules.POLITICAL_CONTENT, "You may not post political content on this platform." },
{ Rules.RAIDS, "You may not plan or participate in \"raids\" on this platform." },
{ Rules.UNDERAGE, "You have to be atleast 18 years old to post." },
{ Rules.VPN_PROXY_TOR, "You may not post through VPNs, Proxies or the TOR network."},
{ Rules.OFF_TOPIC, "You may not post posts, which are not of the same topic as the target board."},
{ Rules.OTHER, "Other (Please specify)"}
};
public static Dictionary<string, Rules> dict2 = new Dictionary<string, Rules>()
{
{ "AGAINSTLAW", Rules.AGAINSTLAW },
{ "NSFW_NSFL", Rules.NSFW_NSFL },
{ "POLITICAL_CONTENT", Rules.POLITICAL_CONTENT },
{ "RAIDS", Rules.RAIDS },
{ "UNDERAGE", Rules.UNDERAGE },
{ "VPN_PROXY_TOR", Rules.VPN_PROXY_TOR },
{ "OFF_TOPIC", Rules.OFF_TOPIC },
{ "OTHER", Rules.OTHER }
};
}