2023-01-25 22:45:36 +00:00
|
|
|
@page "/{boardName}/thread/{threadId}"
|
|
|
|
@using System.ComponentModel.DataAnnotations
|
|
|
|
@using ImageBoardServerApp.Data.Repository
|
|
|
|
@inject NavigationManager NavigationManager
|
|
|
|
|
2023-04-10 17:19:55 +00:00
|
|
|
<PageTitle>Thread #@post.GET on /@boardName/ - BulletBoard</PageTitle>
|
2023-03-07 21:33:36 +00:00
|
|
|
|
2023-04-10 17:19:55 +00:00
|
|
|
<h3>Thread #@post.GET on /@boardName/</h3>
|
2023-01-25 22:45:36 +00:00
|
|
|
<Post post="@post" showOpenThread="false"/>
|
|
|
|
<hr/>
|
|
|
|
|
|
|
|
@foreach (var comment in post.Comments)
|
|
|
|
{
|
|
|
|
<Comment comment="comment"/>
|
|
|
|
<hr/>
|
|
|
|
}
|
2023-02-17 21:54:13 +00:00
|
|
|
<div class="Form">
|
|
|
|
<CommentForm post="post"/>
|
|
|
|
</div>
|
2023-01-25 22:45:36 +00:00
|
|
|
|
|
|
|
@code {
|
2023-06-13 05:42:48 +00:00
|
|
|
|
2023-01-25 22:45:36 +00:00
|
|
|
[Parameter]
|
|
|
|
[Required]
|
|
|
|
public string boardName { get; set; }
|
2023-06-13 05:42:48 +00:00
|
|
|
|
2023-01-25 22:45:36 +00:00
|
|
|
[Parameter]
|
|
|
|
[Required]
|
|
|
|
public string threadId { get; set; }
|
2023-06-13 05:42:48 +00:00
|
|
|
|
2023-01-25 22:45:36 +00:00
|
|
|
private PostData post;
|
|
|
|
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
|
|
{
|
2023-06-13 05:42:48 +00:00
|
|
|
if (!int.TryParse(threadId, out _))
|
2023-01-25 22:45:36 +00:00
|
|
|
NavigationManager.NavigateTo("/notfound");
|
2023-06-13 05:42:48 +00:00
|
|
|
post = await PostsRepository.getPostByIdAsync(int.Parse(threadId));
|
|
|
|
|
|
|
|
if (post == null)
|
2023-01-26 08:07:25 +00:00
|
|
|
NavigationManager.NavigateTo("/notfound");
|
2023-06-13 05:42:48 +00:00
|
|
|
|
|
|
|
if (post.Board != boardName)
|
|
|
|
NavigationManager.NavigateTo("/notfound");
|
|
|
|
if (post == null)
|
2023-01-25 22:45:36 +00:00
|
|
|
NavigationManager.NavigateTo("/notfound");
|
|
|
|
}
|
2023-06-13 05:42:48 +00:00
|
|
|
|
2023-01-25 22:45:36 +00:00
|
|
|
}
|