From e788ddf2a3a25b17c2f48575a057fa017a7e9026 Mon Sep 17 00:00:00 2001 From: limited_dev Date: Tue, 13 Jun 2023 17:08:44 +0200 Subject: [PATCH] feat: added redirect page fix: fixed reloading issues Signed-off-by: limited_dev --- .../Pages/Basic/RedirectTo.razor | 19 +++++++++++++++++++ .../Shared/Components/Comment.razor | 3 +++ .../Shared/Components/Post.razor | 18 +----------------- 3 files changed, 23 insertions(+), 17 deletions(-) create mode 100644 ImageBoardServerApp/Pages/Basic/RedirectTo.razor diff --git a/ImageBoardServerApp/Pages/Basic/RedirectTo.razor b/ImageBoardServerApp/Pages/Basic/RedirectTo.razor new file mode 100644 index 0000000..073286c --- /dev/null +++ b/ImageBoardServerApp/Pages/Basic/RedirectTo.razor @@ -0,0 +1,19 @@ +@page "/sys/click/red/{loc}" +@using System.ComponentModel.DataAnnotations +@inject NavigationManager navManager +

Redirecting...

+ +@code { + + [Parameter] + [Required] + public string loc { get; set; } + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + var p = loc.Replace("_", "/"); + navManager.NavigateTo(p, true, true); + await base.OnAfterRenderAsync(firstRender); + } + +} \ No newline at end of file diff --git a/ImageBoardServerApp/Shared/Components/Comment.razor b/ImageBoardServerApp/Shared/Components/Comment.razor index a397fbb..49f8597 100644 --- a/ImageBoardServerApp/Shared/Components/Comment.razor +++ b/ImageBoardServerApp/Shared/Components/Comment.razor @@ -4,6 +4,8 @@ @using System.Text.RegularExpressions @using System.ComponentModel.DataAnnotations @inject AuthenticationStateProvider authStateProvider +@inject NavigationManager navigationManager; +
[ @@ -132,6 +134,7 @@ if (foundusr.Role != "User" || comment.UserID == foundusr.UserID) { await TheManager.deleteComment(comment); + navigationManager.NavigateTo($"/sys/click/red/_{comment.Board}_thread_{comment.PostID}"); } } diff --git a/ImageBoardServerApp/Shared/Components/Post.razor b/ImageBoardServerApp/Shared/Components/Post.razor index 79d0541..0d60d1f 100644 --- a/ImageBoardServerApp/Shared/Components/Post.razor +++ b/ImageBoardServerApp/Shared/Components/Post.razor @@ -149,22 +149,6 @@
@code { - /* - private RenderFragment[] RenderWithAnchorTags(string input) - { - return input.Split(' ').Select(e => e.StartsWith("https://") || e.StartsWith("http://") - ? (RenderFragment)(builder => - { - builder.OpenElement(0, "a"); - builder.AddAttribute(1, "href", e); - builder.AddContent(2, e); - builder.CloseElement(); - }) - : (RenderFragment)(builder => builder.AddContent(0, e))).ToArray(); - } - */ - - private string reportURL { get; set; } private string threadURL { get; set; } private string openThreadName { get; set; } @@ -203,7 +187,7 @@ if (foundusr.Role != "User" || post.UserID == foundusr.UserID) { await TheManager.deleteThread(post); - navigationManager.NavigateTo($"/{boardTag}"); + navigationManager.NavigateTo($"/sys/click/red/_{boardTag}"); } }