diff --git a/backend/src/Squidex.Domain.Apps.Entities/History/NotifoService.cs b/backend/src/Squidex.Domain.Apps.Entities/History/NotifoService.cs index 7bbac2065..5a258adcf 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/History/NotifoService.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/History/NotifoService.cs @@ -66,20 +66,14 @@ public class NotifoService : IUserEvents } } - public async Task OnUserCreatedAsync(IUser user) + public Task OnUserCreatedAsync(IUser user) { - if (!string.IsNullOrWhiteSpace(user.Email)) - { - await UpsertUserAsync(user); - } + return UpsertUserAsync(user); } - public async Task OnUserUpdatedAsync(IUser user, IUser previous) + public Task OnUserUpdatedAsync(IUser user, IUser previous) { - if (!string.Equals(user.Email, previous?.Email, StringComparison.OrdinalIgnoreCase)) - { - await UpsertUserAsync(user); - } + return UpsertUserAsync(user); } private async Task UpsertUserAsync(IUser user) diff --git a/backend/src/Squidex.Domain.Users/UserWithClaims.cs b/backend/src/Squidex.Domain.Users/UserWithClaims.cs index 8f6dd6a23..a1b0372e8 100644 --- a/backend/src/Squidex.Domain.Users/UserWithClaims.cs +++ b/backend/src/Squidex.Domain.Users/UserWithClaims.cs @@ -7,27 +7,30 @@ using System.Security.Claims; using Microsoft.AspNetCore.Identity; +using Squidex.Infrastructure.Reflection; using Squidex.Shared.Users; namespace Squidex.Domain.Users; internal sealed class UserWithClaims : IUser { + private readonly IdentityUser snapshot; + public IdentityUser Identity { get; } public string Id { - get => Identity.Id; + get => snapshot.Id; } public string Email { - get => Identity.Email!; + get => snapshot.Email!; } public bool IsLocked { - get => Identity.LockoutEnd > DateTime.UtcNow; + get => snapshot.LockoutEnd > DateTime.UtcNow; } public IReadOnlyList Claims { get; } @@ -38,6 +41,10 @@ internal sealed class UserWithClaims : IUser { Identity = user; + // Clone the user so that we capture the previous values, even when the user is updated. + snapshot = SimpleMapper.Map(user, new IdentityUser()); + + // Claims are immutable so we do not need a copy of them. Claims = claims; } } diff --git a/backend/src/Squidex.Infrastructure/Reflection/SimpleMapper.cs b/backend/src/Squidex.Infrastructure/Reflection/SimpleMapper.cs index 327db0ad1..02f7a9baf 100644 --- a/backend/src/Squidex.Infrastructure/Reflection/SimpleMapper.cs +++ b/backend/src/Squidex.Infrastructure/Reflection/SimpleMapper.cs @@ -206,13 +206,6 @@ public static class SimpleMapper } } - public static TTarget Map(TSource source) - where TSource : class - where TTarget : class, new() - { - return Map(source, new TTarget(), CultureInfo.CurrentCulture); - } - public static TTarget Map(TSource source, TTarget target) where TSource : class where TTarget : class diff --git a/frontend/src/app/features/content/pages/content/content-page.component.html b/frontend/src/app/features/content/pages/content/content-page.component.html index de1a7323e..b10a13d97 100644 --- a/frontend/src/app/features/content/pages/content/content-page.component.html +++ b/frontend/src/app/features/content/pages/content/content-page.component.html @@ -53,7 +53,7 @@ - + -
- + - + -
- -
+
+
diff --git a/frontend/src/app/features/teams/pages/contributors/contributors-page.component.html b/frontend/src/app/features/teams/pages/contributors/contributors-page.component.html index 4fe474c9e..2fc5f0aa6 100644 --- a/frontend/src/app/features/teams/pages/contributors/contributors-page.component.html +++ b/frontend/src/app/features/teams/pages/contributors/contributors-page.component.html @@ -2,20 +2,18 @@ -
- - - - -
- -
+ + + + +
+
diff --git a/frontend/src/app/shared/components/notifo.component.scss b/frontend/src/app/shared/components/notifo.component.scss index fee68a37a..0e293eb72 100644 --- a/frontend/src/app/shared/components/notifo.component.scss +++ b/frontend/src/app/shared/components/notifo.component.scss @@ -21,11 +21,11 @@ fill: $color-text-decent; } } + } - .notifo-container { - display: inline-block; - max-width: 5rem; - min-width: 3rem; - } + .notifo-container { + display: inline-block; + max-width: 5rem; + min-width: 3rem; } } \ No newline at end of file