Added notice to UserView when profile is not public

This commit is contained in:
Mia Rose Winter 2024-02-19 00:11:53 +01:00
parent 7a9715977a
commit 9d528dc8f2
Signed by: miawinter
GPG key ID: 4B6F6A83178F595E
3 changed files with 10 additions and 3 deletions

View file

@ -1,11 +1,11 @@
@page "/profile/{id:guid}"
@using Wave.Data
@using Microsoft.EntityFrameworkCore
@using Wave.Components.Account
@using System.Security.Claims
@using Wave.Utilities
@inject IDbContextFactory<ApplicationDbContext> ContextFactory
@inject IStringLocalizer<UserView> Localizer
@inject IMessageDisplay Message
<PageTitle>@(TitlePrefix + @Localizer["Title"] + " | " + (User?.FullName ?? Localizer["NotFound_Title"]))</PageTitle>
@ -78,6 +78,7 @@
// Validate access to user
if (User is not null && User.Articles.Count > 0) {
} else if (User is not null && HttpContext.User.FindFirst("Id")?.Value == User.Id) {
Message.ShowWarning(Localizer["ProfileNotPublic_Message"]);
} else {
User = null;
}

View file

@ -116,4 +116,7 @@
<data name="Articles" xml:space="preserve">
<value>Artikel</value>
</data>
<data name="ProfileNotPublic_Message" xml:space="preserve">
<value>Ihr Profil ist momentan nicht öffentlich einsehbar. </value>
</data>
</root>

View file

@ -116,4 +116,7 @@
<data name="Articles" xml:space="preserve">
<value>Articles</value>
</data>
<data name="ProfileNotPublic_Message" xml:space="preserve">
<value>Your profile is currently not publicly visible.</value>
</data>
</root>