Added notice to UserView when profile is not public
This commit is contained in:
parent
7a9715977a
commit
9d528dc8f2
|
@ -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>
|
||||
|
||||
|
@ -74,10 +74,11 @@
|
|||
.ThenInclude(a => a.Categories)
|
||||
.FirstOrDefaultAsync(u => u.Id == Id.ToString());
|
||||
}
|
||||
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
|
|
@ -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>
|
|
@ -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>
|
Loading…
Reference in a new issue