feat: it is now possible to not show the admin tag when posting, fixed the delete button not showing up

Signed-off-by: limited_dev <loginakkisativ@gmail.com>
This commit is contained in:
limited_dev 2023-06-13 08:51:53 +02:00
parent 9bb208d011
commit 9d733af389
5 changed files with 33 additions and 31 deletions

View file

@ -24,6 +24,12 @@
<div class="pd centered marg">
<RadzenTextArea Placeholder="Comment..." @bind-Value="@postContent" Cols="30" Rows="6" Class="w-100"/>
</div>
<AuthorizeView Roles="Admin,Mod">
<Authorized>
<RadzenCheckBox @bind-Value=@postAnon Name="postAsAnon"/>
<RadzenLabel Text="Do not show role." Component="postAsAnon"/>
</Authorized>
</AuthorizeView>
</div>
</div>
@if (hasErr)
@ -57,6 +63,7 @@
string postUsername { get; set; }
string postContent { get; set; } = "";
bool postAnon { get; set; } = false;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
@ -164,7 +171,8 @@
Username = postUsername,
Board = post.Board,
CreatedAt = DateTimeOffset.Now.ToUnixTimeMilliseconds(),
GET = thisGET
GET = thisGET,
shouldAnon = postAnon
};
}
else
@ -177,7 +185,8 @@
Username = postUsername,
Board = post.Board,
CreatedAt = DateTimeOffset.Now.ToUnixTimeMilliseconds(),
GET = thisGET
GET = thisGET,
shouldAnon = postAnon
};
}

View file

@ -28,6 +28,12 @@
<div class="pd centered marg">
<RadzenTextArea Placeholder="Content..." @bind-Value="@postContent" Cols="30" Rows="6" Class="w-100"/>
</div>
<AuthorizeView Roles="Admin,Mod">
<Authorized>
<RadzenCheckBox @bind-Value=@postAnon Name="postAsAnon"/>
<RadzenLabel Text="Do not show role." Component="postAsAnon"/>
</Authorized>
</AuthorizeView>
</div>
</div>
@if (hasErr)
@ -63,6 +69,7 @@
string postUsername { get; set; }
string postTitle { get; set; } = "";
string postContent { get; set; } = "";
bool postAnon { get; set; } = false;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
@ -175,7 +182,8 @@
Board = board.Tag,
IsLocked = false,
IsSticky = false,
GET = thisGET
GET = thisGET,
shouldAnon = postAnon
};
int postId = await PostsRepository.createPostAsync(postToPost);
if (postId != -1)