[backend/razor] Display pronouns in UserPreview
This commit is contained in:
parent
997ab9558e
commit
a3ad8e5991
2 changed files with 11 additions and 1 deletions
|
@ -16,6 +16,12 @@ else
|
|||
{
|
||||
<div class="user">
|
||||
<UserComponent User="_user"/>
|
||||
@if (_pronouns != null)
|
||||
{
|
||||
<div class="pronouns">
|
||||
@_pronouns
|
||||
</div>
|
||||
}
|
||||
<div class="bio">
|
||||
@(_user.Bio ?? new MarkupString("<i>This user hasn't added a bio yet.</i>"))
|
||||
</div>
|
||||
|
|
|
@ -23,6 +23,7 @@ public partial class UserPreview(
|
|||
|
||||
private PreviewUser? _user;
|
||||
private string _instanceName = "Iceshrimp.NET";
|
||||
private string? _pronouns;
|
||||
|
||||
[SuppressMessage("ReSharper", "EntityFramework.NPlusOne.IncompleteDataQuery")]
|
||||
[SuppressMessage("ReSharper", "EntityFramework.NPlusOne.IncompleteDataUsage")]
|
||||
|
@ -57,6 +58,9 @@ public partial class UserPreview(
|
|||
return;
|
||||
}
|
||||
|
||||
_user = await renderer.RenderOne(user);
|
||||
_user = await renderer.RenderOne(user);
|
||||
_pronouns = user?.UserProfile?.Pronouns != null
|
||||
? string.Join(", ", user.UserProfile.Pronouns.Select(p => $"{p.Value} ({p.Key.ToUpper()})"))
|
||||
: null;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue