[frontend/components] Mark replies to inaccessible posts with lock (ISH-344)

This commit is contained in:
Lilian 2024-09-28 03:19:52 +02:00
parent 24a16f7fad
commit 0cb1403c68
No known key found for this signature in database
5 changed files with 46 additions and 13 deletions

View file

@ -46,7 +46,7 @@
@if (_overrideHide || NoteResponse.Filtered == null)
{
<NoteComponent Note="NoteResponse" Quote="NoteResponse.Quote" Indented="Indented"/>
<NoteComponent Note="NoteResponse" Quote="NoteResponse.Quote" Indented="Indented" ReplyInaccessible="NoteResponse.ReplyInaccessible"/>
}
}
</CascadingValue>

View file

@ -1,11 +1,20 @@
@using Iceshrimp.Shared.Schemas.Web
@using Iceshrimp.Assets.PhosphorIcons
@if (NoteBase.Cw != null)
{
<div class="cw">
<span class="cw-field">@NoteBase.Cw</span><button class="cw-button" @onclick="ToggleCw" @onclick:stopPropagation="true">Toggle CW</button>
</div>
<div hidden="@CwToggle" class="note-body @(CwToggle ? "hidden" : "") @(Indented ? "indent" : "")">
<MfmText Text="@NoteBase.Text" Emoji="@NoteBase.Emoji"/>
<span>
@if (ReplyInaccessible)
{
<span class="reply-inaccessible">
<Icon Name="Icons.ArrowBendLeftUp"/><Icon Name="Icons.Lock"/>
</span>
}
<MfmText Text="@NoteBase.Text" Emoji="@NoteBase.Emoji"/>
</span>
@if (NoteBase.Attachments.Count > 0)
{
<NoteAttachments Attachments="NoteBase.Attachments"/>
@ -17,7 +26,15 @@
<div
class="note-body @(Truncate ? "truncated" : "") @(Indented ? "indent" : "")"
style="max-height: @(Truncate ? MaxHeight + "px" : "initial")">
<MfmText Text="@NoteBase.Text" Emoji="@NoteBase.Emoji"/>
<span>
@if (ReplyInaccessible)
{
<span class="reply-inaccessible">
<Icon Name="Icons.ArrowBendLeftUp"/><Icon Name="Icons.Lock"/>
</span>
}
<MfmText Text="@NoteBase.Text" Emoji="@NoteBase.Emoji"/>
</span>
@if (NoteBase.Attachments.Count > 0)
{
<NoteAttachments Attachments="NoteBase.Attachments"/>
@ -37,7 +54,15 @@
@if (NoteBase.Cw == null && OverLength == false)
{
<div class="note-body @(Indented ? "indent" : "")">
<MfmText Text="@NoteBase.Text" Emoji="@NoteBase.Emoji"/>
<span>
@if (ReplyInaccessible)
{
<span class="reply-inaccessible">
<Icon Name="Icons.ArrowBendLeftUp"/><Icon Name="Icons.Lock"/>
</span>
}
<MfmText Text="@NoteBase.Text" Emoji="@NoteBase.Emoji"/>
</span>
@if (NoteBase.Attachments.Count > 0)
{
<NoteAttachments Attachments="NoteBase.Attachments"/>
@ -47,9 +72,10 @@
@code {
[Parameter] public required NoteBase NoteBase { get; set; }
[Parameter] public required bool OverLength { get; set; }
[Parameter] public bool Indented { get; set; } = false;
[Parameter] public required NoteBase NoteBase { get; set; }
[Parameter] public required bool OverLength { get; set; }
[Parameter] public bool Indented { get; set; }
[Parameter] public bool ReplyInaccessible { get; set; }
private static int MaxHeight => 500;
private bool Truncate { get; set; } = true;

View file

@ -33,3 +33,9 @@
.indent {
padding-left: 0.75em;
}
.reply-inaccessible {
color: var(--notice-color);
vertical-align: middle;
margin-right: 0.25em;
}

View file

@ -17,7 +17,7 @@
CreatedAt="DateTime.Parse(Note.CreatedAt)">
</NoteMetadata>
</div>
<NoteBody NoteBase="Note" OverLength="@CheckLen()" Indented="Indented"/>
<NoteBody NoteBase="Note" OverLength="@CheckLen()" Indented="Indented" ReplyInaccessible="ReplyInaccessible"/>
@if (Quote != null)
{
<div @onclick="OpenQuote" @onclick:stopPropagation="true" class="quote">
@ -37,10 +37,11 @@
}
@code {
[Parameter] [EditorRequired] public required NoteBase Note { get; set; }
[Parameter] public bool Indented { get; set; }
[Parameter] public NoteBase? Quote { get; set; }
[Parameter] public bool AsQuote { get; set; }
[Parameter] [EditorRequired] public required NoteBase Note { get; set; }
[Parameter] public bool Indented { get; set; }
[Parameter] public NoteBase? Quote { get; set; }
[Parameter] public bool AsQuote { get; set; }
[Parameter] public bool ReplyInaccessible { get; set; }
private bool CheckLen()
{

View file

@ -10,7 +10,7 @@ else
{
<div class="ancestor-wrapper" @onclick="() => OpenNote(Note.Reply.Id)">
<div class="note-indent">
<img class="user-avatar" src="@Note.User.AvatarUrl"/>
<img class="user-avatar" src="@Note.Reply.User.AvatarUrl"/>
<Line></Line>
</div>
<div class="note">