From 8ebc78b754dbedac6aa2c91ab7a54794e676c49a Mon Sep 17 00:00:00 2001 From: limited_dev Date: Mon, 27 Feb 2023 14:34:41 +0100 Subject: [PATCH] feat: changed the language of the ReportEntrys to English, started to work on Board Locks, !removed PermissionInteger; as it was not needed anymore! fix: minor bugfixes while posting & commenting, changed Au.razor and E.razor around --- ImageBoardServerApp/Data/UserData.cs | 3 -- .../Pages/Accounts/Register.razor | 1 - ImageBoardServerApp/Pages/Boards/Au.razor | 6 ++-- ImageBoardServerApp/Pages/Boards/E.razor | 6 ++-- .../Shared/Components/Forms/CommentForm.razor | 6 +++- .../Shared/Components/Forms/PostForm.razor | 4 +++ .../Shared/Components/Post.razor | 32 +++++++++++++------ .../Shared/Components/ReportEntry.razor | 20 ++++++------ ImageBoardServerApp/Util/Boards.cs | 9 ++++++ .../{Data => Util}/TheManager.cs | 2 +- ImageBoardServerApp/_Imports.razor | 2 +- 11 files changed, 59 insertions(+), 32 deletions(-) create mode 100644 ImageBoardServerApp/Util/Boards.cs rename ImageBoardServerApp/{Data => Util}/TheManager.cs (94%) diff --git a/ImageBoardServerApp/Data/UserData.cs b/ImageBoardServerApp/Data/UserData.cs index b397f65..438c4d2 100644 --- a/ImageBoardServerApp/Data/UserData.cs +++ b/ImageBoardServerApp/Data/UserData.cs @@ -28,9 +28,6 @@ public class UserData [Required] public string Password { get; set; } - [Required] - public int PermissionInteger { get; set; } - [Required] public string Role { get; set; } diff --git a/ImageBoardServerApp/Pages/Accounts/Register.razor b/ImageBoardServerApp/Pages/Accounts/Register.razor index adbdfc1..a6868ef 100644 --- a/ImageBoardServerApp/Pages/Accounts/Register.razor +++ b/ImageBoardServerApp/Pages/Accounts/Register.razor @@ -34,7 +34,6 @@ Email = Email, Password = BCrypt.Net.BCrypt.HashPassword(Password), Role = "User", - PermissionInteger = 1, TimeBanned = -1 }; if (await UsersRepository.getUserByEmailAsync(Email) != null) diff --git a/ImageBoardServerApp/Pages/Boards/Au.razor b/ImageBoardServerApp/Pages/Boards/Au.razor index e73c04b..8179161 100644 --- a/ImageBoardServerApp/Pages/Boards/Au.razor +++ b/ImageBoardServerApp/Pages/Boards/Au.razor @@ -1,4 +1,4 @@ -@page "/e/" +@page "/au/" @@ -8,7 +8,7 @@ { BoardID = 0, maxThreads = 10, - Tag = "e", - Topic = "Everything" + Tag = "au", + Topic = "Autism" }; } \ No newline at end of file diff --git a/ImageBoardServerApp/Pages/Boards/E.razor b/ImageBoardServerApp/Pages/Boards/E.razor index 8179161..e73c04b 100644 --- a/ImageBoardServerApp/Pages/Boards/E.razor +++ b/ImageBoardServerApp/Pages/Boards/E.razor @@ -1,4 +1,4 @@ -@page "/au/" +@page "/e/" @@ -8,7 +8,7 @@ { BoardID = 0, maxThreads = 10, - Tag = "au", - Topic = "Autism" + Tag = "e", + Topic = "Everything" }; } \ No newline at end of file diff --git a/ImageBoardServerApp/Shared/Components/Forms/CommentForm.razor b/ImageBoardServerApp/Shared/Components/Forms/CommentForm.razor index 5a9c509..0cf2810 100644 --- a/ImageBoardServerApp/Shared/Components/Forms/CommentForm.razor +++ b/ImageBoardServerApp/Shared/Components/Forms/CommentForm.razor @@ -107,7 +107,11 @@ } bool hasImage = selectedFile != null; - + if (postUsername == null || postUsername == "") + { + postUsername = "Anonymous"; + } + CommentData commentToCreate; if (hasImage) { diff --git a/ImageBoardServerApp/Shared/Components/Forms/PostForm.razor b/ImageBoardServerApp/Shared/Components/Forms/PostForm.razor index 73c52b2..99c9c41 100644 --- a/ImageBoardServerApp/Shared/Components/Forms/PostForm.razor +++ b/ImageBoardServerApp/Shared/Components/Forms/PostForm.razor @@ -137,6 +137,10 @@ ImageLocation = $"/img/dynamic/op/{@board.Tag}/{@file}" }; int imageID = await ImagesRepository.createImageAsync(imageToUpload); + if (postUsername == null || postUsername == "") + { + postUsername = "Anonymous"; + } var postToPost = new PostData { UserID = userID, diff --git a/ImageBoardServerApp/Shared/Components/Post.razor b/ImageBoardServerApp/Shared/Components/Post.razor index 2956967..5aa82ea 100644 --- a/ImageBoardServerApp/Shared/Components/Post.razor +++ b/ImageBoardServerApp/Shared/Components/Post.razor @@ -71,12 +71,26 @@ - [ - Sticky - ] - [ - Lock - ] + [ + @if (post.IsSticky) + { + Unsticky + } + else + { + Sticky + } + ] + [ + @if (post.IsLocked) + { + Unlock + } + else + { + Lock + } + ] @@ -85,7 +99,7 @@ ] [ Report - ] + ] @if (showOpenThread) { [ @@ -105,13 +119,13 @@ @code { - private async Task lockMe() + private async void lockMe() { post.IsLocked = !post.IsLocked; await PostsRepository.updatePostAsync(post); } - private async Task stickyMe() + private async void stickyMe() { post.IsSticky = !post.IsSticky; await PostsRepository.updatePostAsync(post); diff --git a/ImageBoardServerApp/Shared/Components/ReportEntry.razor b/ImageBoardServerApp/Shared/Components/ReportEntry.razor index 3069d7b..5a6e7c5 100644 --- a/ImageBoardServerApp/Shared/Components/ReportEntry.razor +++ b/ImageBoardServerApp/Shared/Components/ReportEntry.razor @@ -18,26 +18,26 @@ Explaination: @report.ReportExlaination
Ban User: - 1 Tag + 1d - 7 Tage + 1w - 31 Tage + 1m - 365 Tage + 1yr - 99M Tage + 273,972.6 yrs
Ban Reporter: - 1 Tag + 1d - 7 Tage + 1w - 31 Tage + 1m - 365 Tage + 1yr - 99M Tage + 273,972.6 yrs
Done
diff --git a/ImageBoardServerApp/Util/Boards.cs b/ImageBoardServerApp/Util/Boards.cs new file mode 100644 index 0000000..60d1fb6 --- /dev/null +++ b/ImageBoardServerApp/Util/Boards.cs @@ -0,0 +1,9 @@ +namespace ImageBoardServerApp.Data; + +public class Boards +{ + private List posts = new List() + { + + }; +} \ No newline at end of file diff --git a/ImageBoardServerApp/Data/TheManager.cs b/ImageBoardServerApp/Util/TheManager.cs similarity index 94% rename from ImageBoardServerApp/Data/TheManager.cs rename to ImageBoardServerApp/Util/TheManager.cs index 68ef45f..257125d 100644 --- a/ImageBoardServerApp/Data/TheManager.cs +++ b/ImageBoardServerApp/Util/TheManager.cs @@ -22,7 +22,7 @@ public class TheManager public static long getBumpValue(PostData post) { - return 10 * 60000 - getDiff(post) + ( 60000 * (post.Comments.Count + 1)); + return (post.IsSticky ? 999999999999999999 : 10 * 60000 - getDiff(post) + ( 60000 * (post.Comments.Count + 1))) ; } public static async Task> getPostList(string boardTag) diff --git a/ImageBoardServerApp/_Imports.razor b/ImageBoardServerApp/_Imports.razor index 4340349..9ae8f44 100644 --- a/ImageBoardServerApp/_Imports.razor +++ b/ImageBoardServerApp/_Imports.razor @@ -17,4 +17,4 @@ @using ImageBoardServerApp.Shared @using ImageBoardServerApp.Shared.Components @using ImageBoardServerApp.Shared.Components.Forms -@using ImageBoardServerApp.Data +@using ImageBoardServerApp.Data \ No newline at end of file