(ApiRoutes.Users.UPDATE_USER_SETTINGS, request, cancellationToken).ConfigureAwait(false);
+
+ // keep the per-user theme cache preference in sync with the stored settings, so the handler applies it immediately
+ Guid? userId = GetCurrentUserId();
+ if (userId is not null)
+ await _themeCachePreferenceService.SetAsync(userId.Value, request.IsThemeCachingEnabled, cancellationToken).ConfigureAwait(false);
+
return JsonSuccess(new { isUpdated = true });
}
+
+ ///
+ /// Gets the unique identifier of the currently authenticated user.
+ ///
+ /// The unique identifier of the current user, or when the request is anonymous.
+ private Guid? GetCurrentUserId()
+ {
+ string? userId = User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
+ return Guid.TryParse(userId, out Guid parsedUserId) ? parsedUserId : null;
+ }
}
diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.de-DE.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.de-DE.resx
index 7f312406..5f1d8361 100644
--- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.de-DE.resx
+++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.de-DE.resx
@@ -39,4 +39,10 @@
Wenn aktiviert, werden Bibliothekselemente, deren Titel mit "The" beginnt, in der Alpha-Auswahl unter dem ersten Buchstaben des folgenden Wortes gruppiert, z. B. wird "The Rasmus" unter R aufgeführt.
+
+ Themencache aktivieren
+
+
+ Gibt an, ob die von der Anwendung bereitgestellten Themendateien zwischengespeichert werden. Deaktivieren Sie diese Option beim Bearbeiten von Themendateien, damit die Änderungen sofort erscheinen.
+
diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.en-US.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.en-US.resx
index d7ecb8c2..da463e75 100644
--- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.en-US.resx
+++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.en-US.resx
@@ -39,4 +39,10 @@
When enabled, library items whose title begins with "The" are grouped under the first letter of the following word in the alpha picker, e.g. "The Rasmus" is listed under R.
+
+ Enable theme caching
+
+
+ Whether the theme files served by the application are cached. Turn this off while editing theme files so the changes appear immediately.
+
diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.es-ES.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.es-ES.resx
index 46197a4f..0cfad2b5 100644
--- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.es-ES.resx
+++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.es-ES.resx
@@ -39,4 +39,10 @@
Cuando está habilitado, los elementos de la biblioteca cuyo título comienza con "The" se agrupan bajo la primera letra de la palabra siguiente en el selector alfabético, por ejemplo, "The Rasmus" se lista bajo R.
+
+ Habilitar caché de temas
+
+
+ Controla si los archivos de temas servidos por la aplicación se almacenan en caché. Desactívelo mientras edita archivos de temas para que los cambios aparezcan inmediatamente.
+
diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.fr-FR.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.fr-FR.resx
index 0d086bdd..7327abbf 100644
--- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.fr-FR.resx
+++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.fr-FR.resx
@@ -39,4 +39,10 @@
Lorsque cette option est activée, les éléments de la bibliothèque dont le titre commence par "The" sont regroupés sous la première lettre du mot suivant dans le sélecteur alphabétique, par exemple "The Rasmus" est répertorié sous R.
+
+ Activer le cache des thèmes
+
+
+ Contrôle si les fichiers de thèmes servis par l'application sont mis en cache. Désactivez-le pendant la modification des fichiers de thèmes afin que les changements apparaissent immédiatement.
+
diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.it-IT.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.it-IT.resx
index f88da291..c29b3a31 100644
--- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.it-IT.resx
+++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.it-IT.resx
@@ -39,4 +39,10 @@
Se abilitato, gli elementi della libreria il cui titolo inizia con "The" vengono raggruppati sotto la prima lettera della parola successiva nel selettore alfabetico, ad esempio "The Rasmus" è elencato sotto R.
+
+ Abilita la cache dei temi
+
+
+ Controlla se i file dei temi serviti dall'applicazione vengono memorizzati nella cache. Disattivalo mentre modifichi i file dei temi affinché le modifiche appaiano immediatamente.
+
diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ja-JP.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ja-JP.resx
index 78c7e46f..6dc95ed9 100644
--- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ja-JP.resx
+++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ja-JP.resx
@@ -39,4 +39,10 @@
有効にすると、タイトルが「The」で始まるライブラリの項目は、アルファピッカーで次の単語の最初の文字の下にグループ化されます。たとえば「The Rasmus」は「R」の下に表示されます。
+
+ テーマキャッシュを有効にする
+
+
+ アプリケーションが提供するテーマファイルをキャッシュするかどうかを制御します。テーマファイルを編集している間はオフにして、変更がすぐに反映されるようにします。
+
diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.resx
index d7ecb8c2..da463e75 100644
--- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.resx
+++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.resx
@@ -39,4 +39,10 @@
When enabled, library items whose title begins with "The" are grouped under the first letter of the following word in the alpha picker, e.g. "The Rasmus" is listed under R.
+
+ Enable theme caching
+
+
+ Whether the theme files served by the application are cached. Turn this off while editing theme files so the changes appear immediately.
+
diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ro-RO.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ro-RO.resx
index add6888f..b36b2406 100644
--- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ro-RO.resx
+++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ro-RO.resx
@@ -39,4 +39,10 @@
Când este activată, elementele bibliotecii al căror titlu începe cu "The" sunt grupate sub prima literă a cuvântului următor în selectorul alfabetic, de exemplu "The Rasmus" este listat sub R.
+
+ Activează cache-ul temelor
+
+
+ Controlează dacă fișierele temelor servite de aplicație sunt puse în cache. Dezactivați această opțiune în timp ce editați fișierele temelor, pentru ca modificările să apară imediat.
+
diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ru-RU.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ru-RU.resx
index 5657d5a6..e44f8385 100644
--- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ru-RU.resx
+++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ru-RU.resx
@@ -39,4 +39,10 @@
При включении элементы библиотеки, название которых начинается с "The", группируются в алфавитном указателе под первой буквой следующего слова, например "The Rasmus" отображается под буквой R.
+
+ Включить кэширование тем
+
+
+ Определяет, кэшируются ли файлы тем, предоставляемые приложением. Отключите эту опцию при редактировании файлов тем, чтобы изменения отображались сразу.
+
diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.zh-CN.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.zh-CN.resx
index 00301a1b..857dd54f 100644
--- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.zh-CN.resx
+++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.zh-CN.resx
@@ -39,4 +39,10 @@
启用后,标题以"The"开头的库项目将在字母选择器中按后一个词的首字母分组,例如"The Rasmus"会列在R下。
+
+ 启用主题缓存
+
+
+ 控制应用程序提供的主题文件是否缓存。编辑主题文件时请关闭此选项,以便更改立即生效。
+
diff --git a/src/Lumina.Presentation.Web/Core/Views/Tools/Settings.cshtml b/src/Lumina.Presentation.Web/Core/Views/Tools/Settings.cshtml
index 7ea8be9a..7f62b856 100644
--- a/src/Lumina.Presentation.Web/Core/Views/Tools/Settings.cshtml
+++ b/src/Lumina.Presentation.Web/Core/Views/Tools/Settings.cshtml
@@ -65,6 +65,19 @@
@_localizer["DescriptionIgnoreThePrefixForAlphaPicker"]
+
+
@@ -82,6 +95,7 @@
const checkboxIsPaginationEnabled = document.getElementById('IsPaginationEnabled');
const inputItemsPerPage = document.getElementById('ItemsPerPage');
const checkboxIgnoreThePrefixForAlphaPicker = document.getElementById('IgnoreThePrefixForAlphaPicker');
+ const checkboxIsThemeCachingEnabled = document.getElementById('IsThemeCachingEnabled');
// toggle the enabled state of the items per page input based on the pagination checkbox
function updateItemsPerPageEnabledState() {
@@ -95,6 +109,7 @@
checkboxIsPaginationEnabled.checked = data.isPaginationEnabled === true;
inputItemsPerPage.value = data.itemsPerPage;
checkboxIgnoreThePrefixForAlphaPicker.checked = data.ignoreThePrefixForAlphaPicker === true;
+ checkboxIsThemeCachingEnabled.checked = data.isThemeCachingEnabled === true;
updateItemsPerPageEnabledState();
}
}
@@ -104,7 +119,8 @@
const formData = {
IsPaginationEnabled: checkboxIsPaginationEnabled.checked,
ItemsPerPage: Number(inputItemsPerPage.value),
- IgnoreThePrefixForAlphaPicker: checkboxIgnoreThePrefixForAlphaPicker.checked
+ IgnoreThePrefixForAlphaPicker: checkboxIgnoreThePrefixForAlphaPicker.checked,
+ IsThemeCachingEnabled: checkboxIsThemeCachingEnabled.checked
};
const data = await callApiPostAsync('@_urlService.GetAbsoluteUrl(WebRoutes.Settings.UPDATE_USER_SETTINGS)', formData);
if (data && data.isUpdated === true)
diff --git a/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/UsersManagement/UserSettingsEntityFixture.cs b/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/UsersManagement/UserSettingsEntityFixture.cs
index d11a1fdc..e6e86104 100644
--- a/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/UsersManagement/UserSettingsEntityFixture.cs
+++ b/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/UsersManagement/UserSettingsEntityFixture.cs
@@ -23,13 +23,15 @@ public class UserSettingsEntityFixture
/// Optional. Whether pagination is enabled for the user, or not.
/// Optional. The number of library items displayed per page when pagination is enabled.
/// Optional. Whether the "The" prefix is ignored by the alpha picker, or not.
+ /// Optional. Whether the theme data served to this user is cached, or not.
/// The created user settings entity.
public UserSettingsEntity Create(
Guid? id = null,
Guid? userId = null,
bool? isPaginationEnabled = null,
int? itemsPerPage = null,
- bool? ignoreThePrefixForAlphaPicker = null)
+ bool? ignoreThePrefixForAlphaPicker = null,
+ bool? isThemeCachingEnabled = null)
{
return new Faker()
.CustomInstantiator(f => new UserSettingsEntity
@@ -38,7 +40,8 @@ public class UserSettingsEntityFixture
UserId = userId ?? Guid.NewGuid(),
IsPaginationEnabled = isPaginationEnabled ?? f.Random.Bool(),
ItemsPerPage = itemsPerPage ?? f.Random.Int(1, 100),
- IgnoreThePrefixForAlphaPicker = ignoreThePrefixForAlphaPicker ?? f.Random.Bool()
+ IgnoreThePrefixForAlphaPicker = ignoreThePrefixForAlphaPicker ?? f.Random.Bool(),
+ IsThemeCachingEnabled = isThemeCachingEnabled ?? f.Random.Bool()
})
.Generate();
}
diff --git a/tests/Common/Lumina.Application.Fixtures/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandFixture.cs b/tests/Common/Lumina.Application.Fixtures/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandFixture.cs
index 7fc9e855..d26b85c7 100644
--- a/tests/Common/Lumina.Application.Fixtures/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandFixture.cs
+++ b/tests/Common/Lumina.Application.Fixtures/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandFixture.cs
@@ -20,17 +20,20 @@ public class UpdateUserSettingsCommandFixture
/// Optional. Whether pagination is enabled for the user, or not.
/// Optional. The number of library items displayed per page when pagination is enabled.
/// Optional. Whether the "The" prefix is ignored by the alpha picker, or not.
+ /// Optional. Whether the theme data served to this user is cached, or not.
/// The created command.
public UpdateUserSettingsCommand Create(
bool? isPaginationEnabled = null,
int? itemsPerPage = null,
- bool? ignoreThePrefixForAlphaPicker = null)
+ bool? ignoreThePrefixForAlphaPicker = null,
+ bool? isThemeCachingEnabled = null)
{
return new Faker()
- .CustomInstantiator(f => new UpdateUserSettingsCommand(default, default, default))
+ .CustomInstantiator(f => new UpdateUserSettingsCommand(default, default, default, default))
.RuleFor(x => x.IsPaginationEnabled, f => isPaginationEnabled ?? f.Random.Bool())
.RuleFor(x => x.ItemsPerPage, f => itemsPerPage ?? f.Random.Int(1, 100))
.RuleFor(x => x.IgnoreThePrefixForAlphaPicker, f => ignoreThePrefixForAlphaPicker ?? f.Random.Bool())
+ .RuleFor(x => x.IsThemeCachingEnabled, f => isThemeCachingEnabled ?? f.Random.Bool())
.Generate();
}
diff --git a/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettingsFixture.cs b/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettingsFixture.cs
index dc4ffd36..89134b4e 100644
--- a/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettingsFixture.cs
+++ b/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettingsFixture.cs
@@ -23,18 +23,21 @@ public class UserSettingsFixture
/// Whether pagination is enabled for the user.
/// The number of library items displayed per page when pagination is enabled.
/// Whether the "The" prefix of library item titles is ignored by the alpha picker.
+ /// Whether the theme data served to this user is cached.
/// The created .
public UserSettings Create(
Guid? userId = null,
bool isPaginationEnabled = true,
int itemsPerPage = 48,
- bool ignoreThePrefixForAlphaPicker = false)
+ bool ignoreThePrefixForAlphaPicker = false,
+ bool isThemeCachingEnabled = true)
{
Result settings = UserSettings.Create(
userId is null ? UserId.CreateUnique() : UserId.Create(userId.Value),
isPaginationEnabled,
itemsPerPage,
- ignoreThePrefixForAlphaPicker);
+ ignoreThePrefixForAlphaPicker,
+ isThemeCachingEnabled);
return settings.Value;
}
diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Settings/UpdateUserSettings/UpdateUserSettingsEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Settings/UpdateUserSettings/UpdateUserSettingsEndpointTests.cs
index 34faea2e..105106e8 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Settings/UpdateUserSettings/UpdateUserSettingsEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Settings/UpdateUserSettings/UpdateUserSettingsEndpointTests.cs
@@ -59,7 +59,8 @@ public class UpdateUserSettingsEndpointTests : IClassFixture
UpdateUserSettingsRequest request = new(
IsPaginationEnabled: true,
ItemsPerPage: 48,
- IgnoreThePrefixForAlphaPicker: false
+ IgnoreThePrefixForAlphaPicker: false,
+ IsThemeCachingEnabled: true
);
// Act
@@ -79,7 +80,8 @@ public class UpdateUserSettingsEndpointTests : IClassFixture
UpdateUserSettingsRequest request = new(
IsPaginationEnabled: true,
ItemsPerPage: int.MaxValue,
- IgnoreThePrefixForAlphaPicker: false
+ IgnoreThePrefixForAlphaPicker: false,
+ IsThemeCachingEnabled: true
);
// Act
@@ -101,7 +103,8 @@ public class UpdateUserSettingsEndpointTests : IClassFixture
UpdateUserSettingsRequest request = new(
IsPaginationEnabled: true,
ItemsPerPage: int.MinValue,
- IgnoreThePrefixForAlphaPicker: false
+ IgnoreThePrefixForAlphaPicker: false,
+ IsThemeCachingEnabled: true
);
// Act
diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/UsersManagement/Users/UpdateUserSettingsRequestMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/UsersManagement/Users/UpdateUserSettingsRequestMappingTests.cs
index 52e66af8..3a7aa785 100644
--- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/UsersManagement/Users/UpdateUserSettingsRequestMappingTests.cs
+++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/UsersManagement/Users/UpdateUserSettingsRequestMappingTests.cs
@@ -17,7 +17,7 @@ public class UpdateUserSettingsRequestMappingTests
public void ToCommand_WhenMappingValidRequest_ShouldMapCorrectly()
{
// Arrange
- UpdateUserSettingsRequest request = new(IsPaginationEnabled: true, ItemsPerPage: 48, IgnoreThePrefixForAlphaPicker: false);
+ UpdateUserSettingsRequest request = new(IsPaginationEnabled: true, ItemsPerPage: 48, IgnoreThePrefixForAlphaPicker: false, IsThemeCachingEnabled: true);
// Act
UpdateUserSettingsCommand result = request.ToCommand();
@@ -27,5 +27,6 @@ public class UpdateUserSettingsRequestMappingTests
Assert.Equal(request.IsPaginationEnabled, result.IsPaginationEnabled);
Assert.Equal(request.ItemsPerPage, result.ItemsPerPage);
Assert.Equal(request.IgnoreThePrefixForAlphaPicker, result.IgnoreThePrefixForAlphaPicker);
+ Assert.Equal(request.IsThemeCachingEnabled, result.IsThemeCachingEnabled);
}
}
diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/UsersManagement/Users/UserSettingsEntityMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/UsersManagement/Users/UserSettingsEntityMappingTests.cs
index 5ac4822a..f87c367b 100644
--- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/UsersManagement/Users/UserSettingsEntityMappingTests.cs
+++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/UsersManagement/Users/UserSettingsEntityMappingTests.cs
@@ -34,6 +34,7 @@ public class UserSettingsEntityMappingTests
Assert.Equal(entity.IsPaginationEnabled, result.Value.IsPaginationEnabled);
Assert.Equal(entity.ItemsPerPage, result.Value.ItemsPerPage);
Assert.Equal(entity.IgnoreThePrefixForAlphaPicker, result.Value.IgnoreThePrefixForAlphaPicker);
+ Assert.Equal(entity.IsThemeCachingEnabled, result.Value.IsThemeCachingEnabled);
}
[Fact]
@@ -51,5 +52,6 @@ public class UserSettingsEntityMappingTests
Assert.Equal(entity.IsPaginationEnabled, result.IsPaginationEnabled);
Assert.Equal(entity.ItemsPerPage, result.ItemsPerPage);
Assert.Equal(entity.IgnoreThePrefixForAlphaPicker, result.IgnoreThePrefixForAlphaPicker);
+ Assert.Equal(entity.IsThemeCachingEnabled, result.IsThemeCachingEnabled);
}
}
diff --git a/tests/UnitTests/Lumina.Contracts.UnitTests/Requests/UsersManagement/Settings/UpdateUserSettingsRequestTests.cs b/tests/UnitTests/Lumina.Contracts.UnitTests/Requests/UsersManagement/Settings/UpdateUserSettingsRequestTests.cs
index 44bfcd8b..a8b6cbfc 100644
--- a/tests/UnitTests/Lumina.Contracts.UnitTests/Requests/UsersManagement/Settings/UpdateUserSettingsRequestTests.cs
+++ b/tests/UnitTests/Lumina.Contracts.UnitTests/Requests/UsersManagement/Settings/UpdateUserSettingsRequestTests.cs
@@ -21,7 +21,7 @@ public class UpdateUserSettingsRequestTests
public void RoundTrip_WhenSerializingUpdateUserSettingsRequest_ShouldPreserveValues()
{
// Arrange
- UpdateUserSettingsRequest expected = new(true, 50, true);
+ UpdateUserSettingsRequest expected = new(true, 50, true, true);
// Act
string json = JsonSerializer.Serialize(expected, _jsonOptions);
@@ -36,14 +36,15 @@ public class UpdateUserSettingsRequestTests
public void Deconstruct_WhenCalled_ShouldReturnAllProperties()
{
// Arrange
- UpdateUserSettingsRequest sut = new(false, 25, false);
+ UpdateUserSettingsRequest sut = new(false, 25, false, false);
// Act
- (bool isPaginationEnabled, int itemsPerPage, bool ignoreThePrefixForAlphaPicker) = sut;
+ (bool isPaginationEnabled, int itemsPerPage, bool ignoreThePrefixForAlphaPicker, bool isThemeCachingEnabled) = sut;
// Assert
Assert.Equal(sut.IsPaginationEnabled, isPaginationEnabled);
Assert.Equal(sut.ItemsPerPage, itemsPerPage);
Assert.Equal(sut.IgnoreThePrefixForAlphaPicker, ignoreThePrefixForAlphaPicker);
+ Assert.Equal(sut.IsThemeCachingEnabled, isThemeCachingEnabled);
}
}
diff --git a/tests/UnitTests/Lumina.Contracts.UnitTests/Responses/UsersManagement/Settings/UserSettingsResponseTests.cs b/tests/UnitTests/Lumina.Contracts.UnitTests/Responses/UsersManagement/Settings/UserSettingsResponseTests.cs
index ac566276..0bd9c3ff 100644
--- a/tests/UnitTests/Lumina.Contracts.UnitTests/Responses/UsersManagement/Settings/UserSettingsResponseTests.cs
+++ b/tests/UnitTests/Lumina.Contracts.UnitTests/Responses/UsersManagement/Settings/UserSettingsResponseTests.cs
@@ -23,7 +23,7 @@ public class UserSettingsResponseTests
{
// Arrange
Guid userId = Guid.NewGuid();
- UserSettingsResponse expected = new(userId, true, 50, true);
+ UserSettingsResponse expected = new(userId, true, 50, true, true);
// Act
string json = JsonSerializer.Serialize(expected, _jsonOptions);
@@ -39,15 +39,16 @@ public class UserSettingsResponseTests
{
// Arrange
Guid userId = Guid.NewGuid();
- UserSettingsResponse sut = new(userId, false, 25, false);
+ UserSettingsResponse sut = new(userId, false, 25, false, false);
// Act
- (Guid sutUserId, bool isPaginationEnabled, int itemsPerPage, bool ignoreThePrefixForAlphaPicker) = sut;
+ (Guid sutUserId, bool isPaginationEnabled, int itemsPerPage, bool ignoreThePrefixForAlphaPicker, bool isThemeCachingEnabled) = sut;
// Assert
Assert.Equal(sut.UserId, sutUserId);
Assert.Equal(sut.IsPaginationEnabled, isPaginationEnabled);
Assert.Equal(sut.ItemsPerPage, itemsPerPage);
Assert.Equal(sut.IgnoreThePrefixForAlphaPicker, ignoreThePrefixForAlphaPicker);
+ Assert.Equal(sut.IsThemeCachingEnabled, isThemeCachingEnabled);
}
}
diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettingsTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettingsTests.cs
index 8b0460c0..d1abc2cf 100644
--- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettingsTests.cs
+++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettingsTests.cs
@@ -72,7 +72,7 @@ public class UserSettingsTests
UserId userId = _userIdFixture.Create();
// Act
- Result result = UserSettings.Create(userId, isPaginationEnabled: false, itemsPerPage: 24, ignoreThePrefixForAlphaPicker: true);
+ Result result = UserSettings.Create(userId, isPaginationEnabled: false, itemsPerPage: 24, ignoreThePrefixForAlphaPicker: true, isThemeCachingEnabled: true);
// Assert
Assert.False(result.IsFailure);
@@ -80,6 +80,7 @@ public class UserSettingsTests
Assert.False(result.Value.IsPaginationEnabled);
Assert.Equal(24, result.Value.ItemsPerPage);
Assert.True(result.Value.IgnoreThePrefixForAlphaPicker);
+ Assert.True(result.Value.IsThemeCachingEnabled);
}
[Fact]
@@ -105,7 +106,7 @@ public class UserSettingsTests
UserId userId = _userIdFixture.Create();
// Act
- Result result = UserSettings.Create(userId, isPaginationEnabled: true, itemsPerPage: itemsPerPage, ignoreThePrefixForAlphaPicker: false);
+ Result result = UserSettings.Create(userId, isPaginationEnabled: true, itemsPerPage: itemsPerPage, ignoreThePrefixForAlphaPicker: false, isThemeCachingEnabled: true);
// Assert
Assert.True(result.IsFailure);
@@ -119,13 +120,14 @@ public class UserSettingsTests
UserSettings userSettings = _userSettingsFixture.Create();
// Act
- Result result = userSettings.UpdateSettings(isPaginationEnabled: false, itemsPerPage: 12, ignoreThePrefixForAlphaPicker: true);
+ Result result = userSettings.UpdateSettings(isPaginationEnabled: false, itemsPerPage: 12, ignoreThePrefixForAlphaPicker: true, isThemeCachingEnabled: false);
// Assert
Assert.False(result.IsFailure);
Assert.False(userSettings.IsPaginationEnabled);
Assert.Equal(12, userSettings.ItemsPerPage);
Assert.True(userSettings.IgnoreThePrefixForAlphaPicker);
+ Assert.False(userSettings.IsThemeCachingEnabled);
}
[Theory]
@@ -137,7 +139,7 @@ public class UserSettingsTests
UserSettings userSettings = _userSettingsFixture.Create();
// Act
- Result result = userSettings.UpdateSettings(isPaginationEnabled: true, itemsPerPage: itemsPerPage, ignoreThePrefixForAlphaPicker: false);
+ Result result = userSettings.UpdateSettings(isPaginationEnabled: true, itemsPerPage: itemsPerPage, ignoreThePrefixForAlphaPicker: false, isThemeCachingEnabled: true);
// Assert
Assert.True(result.IsFailure);
diff --git a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/UsersManagement/Settings/GetUserSettings/GetUserSettingsEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/UsersManagement/Settings/GetUserSettings/GetUserSettingsEndpointTests.cs
index 122bb46c..190e76d7 100644
--- a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/UsersManagement/Settings/GetUserSettings/GetUserSettingsEndpointTests.cs
+++ b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/UsersManagement/Settings/GetUserSettings/GetUserSettingsEndpointTests.cs
@@ -39,7 +39,7 @@ public class GetUserSettingsEndpointTests
{
// Arrange
CancellationToken cancellationToken = CancellationToken.None;
- UserSettingsResponse expectedResponse = new(Guid.NewGuid(), true, 48, false);
+ UserSettingsResponse expectedResponse = new(Guid.NewGuid(), true, 48, false, true);
_mockHandler.HandleAsync(Arg.Any(), Arg.Any())
.Returns(Result.From(expectedResponse));
@@ -79,7 +79,7 @@ public class GetUserSettingsEndpointTests
// Arrange
CancellationToken cancellationToken = CancellationToken.None;
_mockHandler.HandleAsync(Arg.Any(), Arg.Any())
- .Returns(Result.From(new UserSettingsResponse(Guid.NewGuid(), true, 48, false)));
+ .Returns(Result.From(new UserSettingsResponse(Guid.NewGuid(), true, 48, false, true)));
// Act
await _sut.ExecuteAsync(EmptyRequest.Instance, cancellationToken);
@@ -104,7 +104,7 @@ public class GetUserSettingsEndpointTests
operationStarted.SetResult(true);
await cancellationRequested.Task;
info.Arg().ThrowIfCancellationRequested();
- return Result.From(new UserSettingsResponse(Guid.NewGuid(), true, 48, false));
+ return Result.From(new UserSettingsResponse(Guid.NewGuid(), true, 48, false, true));
}, info.Arg()));
// Act
diff --git a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/UsersManagement/Settings/UpdateUserSettings/UpdateUserSettingsEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/UsersManagement/Settings/UpdateUserSettings/UpdateUserSettingsEndpointTests.cs
index 03c65397..5e15bdf4 100644
--- a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/UsersManagement/Settings/UpdateUserSettings/UpdateUserSettingsEndpointTests.cs
+++ b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/UsersManagement/Settings/UpdateUserSettings/UpdateUserSettingsEndpointTests.cs
@@ -37,7 +37,7 @@ public class UpdateUserSettingsEndpointTests
public async Task ExecuteAsync_WhenSuccessful_ShouldReturnOkResultWithUpdatedMarker()
{
// Arrange
- UpdateUserSettingsRequest request = new(true, 48, false);
+ UpdateUserSettingsRequest request = new(true, 48, false, true);
CancellationToken cancellationToken = CancellationToken.None;
_mockHandler.HandleAsync(Arg.Any(), Arg.Any())
.Returns(Result.Updated);
@@ -54,7 +54,7 @@ public class UpdateUserSettingsEndpointTests
public async Task ExecuteAsync_WhenHandlerReturnsError_ShouldReturnProblemResult()
{
// Arrange
- UpdateUserSettingsRequest request = new(true, 0, false);
+ UpdateUserSettingsRequest request = new(true, 0, false, true);
CancellationToken cancellationToken = CancellationToken.None;
Error expectedError = Error.Validation("UserSettings.ItemsPerPageMustBeGreaterThanZero", "ItemsPerPage must be greater than zero.");
_mockHandler.HandleAsync(Arg.Any(), Arg.Any())
@@ -76,7 +76,7 @@ public class UpdateUserSettingsEndpointTests
public async Task ExecuteAsync_WhenCalled_ShouldSendUpdateUserSettingsCommandToHandler()
{
// Arrange
- UpdateUserSettingsRequest request = new(true, 24, true);
+ UpdateUserSettingsRequest request = new(true, 24, true, true);
CancellationToken cancellationToken = CancellationToken.None;
_mockHandler.HandleAsync(Arg.Any(), Arg.Any())
.Returns(Result.Updated);
@@ -89,7 +89,8 @@ public class UpdateUserSettingsEndpointTests
Arg.Is(command =>
command.IsPaginationEnabled == request.IsPaginationEnabled &&
command.ItemsPerPage == request.ItemsPerPage &&
- command.IgnoreThePrefixForAlphaPicker == request.IgnoreThePrefixForAlphaPicker),
+ command.IgnoreThePrefixForAlphaPicker == request.IgnoreThePrefixForAlphaPicker &&
+ command.IsThemeCachingEnabled == request.IsThemeCachingEnabled),
Arg.Is(cancellationToken));
}
@@ -111,7 +112,7 @@ public class UpdateUserSettingsEndpointTests
}, info.Arg