From 6e9be8c931e225ede100ef7aa4f7be248fe92509 Mon Sep 17 00:00:00 2001 From: limited_dev Date: Sat, 4 Mar 2023 23:09:26 +0100 Subject: [PATCH] finished Board Locking --- .../Shared/Components/Forms/CommentForm.razor | 8 ++++++++ .../Shared/Components/Forms/PostForm.razor | 11 ++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ImageBoardServerApp/Shared/Components/Forms/CommentForm.razor b/ImageBoardServerApp/Shared/Components/Forms/CommentForm.razor index 0cf2810..df0a2c2 100644 --- a/ImageBoardServerApp/Shared/Components/Forms/CommentForm.razor +++ b/ImageBoardServerApp/Shared/Components/Forms/CommentForm.razor @@ -106,6 +106,14 @@ return; } + BoardData b = await BoardsRepository.getBoardByTagAsync(post.Board); + if (b.isLocked) + { + hasErr = true; + postErr = "This board is currently locked."; + return; + } + bool hasImage = selectedFile != null; if (postUsername == null || postUsername == "") { diff --git a/ImageBoardServerApp/Shared/Components/Forms/PostForm.razor b/ImageBoardServerApp/Shared/Components/Forms/PostForm.razor index 99c9c41..24e8451 100644 --- a/ImageBoardServerApp/Shared/Components/Forms/PostForm.razor +++ b/ImageBoardServerApp/Shared/Components/Forms/PostForm.razor @@ -29,7 +29,7 @@
- +
@@ -110,6 +110,15 @@ //Maybe redirect to /banned? return; } + + BoardData b = await BoardsRepository.getBoardByTagAsync(board.Tag); + if (b.isLocked) + { + hasErr = true; + postErr = "This board is currently locked."; + return; + } + foundusr.lastActionTimeStamp = DateTimeOffset.Now.ToUnixTimeMilliseconds(); await UsersRepository.updateUserAsync(foundusr);