[backend/razor] Allow clicking on display name & avatars in public note preview

This commit is contained in:
Laura Hausmann 2024-09-19 00:34:55 +02:00
parent d47f2ccd4c
commit 500217021c
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
3 changed files with 8 additions and 2 deletions

View file

@ -19,11 +19,12 @@ else
var acct = "@" + note.User.Username + (note.User.IsLocalUser ? "" : "@" + note.User.Host);
var displayName = note.User.DisplayName;
var username = note.User.Username;
var url = note.User.UserProfile?.Url ?? note.User.Uri ?? note.User.GetPublicUrl(Model.WebDomain);
var avatarUrl = note.User.AvatarUrl == null || !Model.ShowMedia ? note.User.IdenticonUrlPath : note.User.AvatarUrl;
<div class="user">
<img src="@avatarUrl" class="avatar" alt="User avatar"/>
<div class="title">@name by <span>@(displayName ?? username)</span></div>
<a href="@url"><img src="@avatarUrl" class="avatar" alt="User avatar"/></a>
<div class="title">@name by <a class="display-name" href="@url">@(displayName ?? username)</a></div>
<span class="acct">@acct</span>
</div>
<small>Published at: @note.CreatedAt.ToDisplayString()</small>

View file

@ -27,6 +27,7 @@ public class NoteModel(
public bool ShowMedia = security.Value.PublicPreview > Enums.PublicPreview.RestrictedNoMedia;
public bool ShowRemoteReplies = security.Value.PublicPreview > Enums.PublicPreview.Restricted;
public string InstanceName = "Iceshrimp.NET";
public string WebDomain = config.Value.WebDomain;
public Dictionary<string, string> TextContent = new();

View file

@ -41,4 +41,8 @@
.note {
background-color: var(--background-body)
}
.display-name {
color: var(--text-bright);
}