diff --git a/BTCPayServer/Views/Shared/Monero/StoreNavMoneroExtension.cshtml b/BTCPayServer/Views/Shared/Monero/StoreNavMoneroExtension.cshtml index 97f68afd4..fc5ca8bdb 100644 --- a/BTCPayServer/Views/Shared/Monero/StoreNavMoneroExtension.cshtml +++ b/BTCPayServer/Views/Shared/Monero/StoreNavMoneroExtension.cshtml @@ -1,12 +1,16 @@ @using BTCPayServer.Services.Altcoins.Monero.Configuration @using BTCPayServer.Services.Altcoins.Monero.UI +@using Microsoft.AspNetCore.Mvc.TagHelpers +@using BTCPayServer.Abstractions.Contracts @inject SignInManager SignInManager; @inject MoneroLikeConfiguration MoneroLikeConfiguration; +@inject IScopeProvider ScopeProvider @{ - var controller = ViewContext.RouteData.Values["Controller"].ToString(); - var isMonero = controller.Equals(nameof(UIMoneroLikeStoreController), StringComparison.InvariantCultureIgnoreCase); + var storeId = ScopeProvider.GetCurrentStoreId(); + var isActive = !string.IsNullOrEmpty(storeId) && ViewContext.RouteData.Values.TryGetValue("Controller", out var controller) && controller is not null && + nameof(UIMoneroLikeStoreController).StartsWith(controller.ToString() ?? string.Empty, StringComparison.InvariantCultureIgnoreCase); } @if (SignInManager.IsSignedIn(User) && User.IsInRole(Roles.ServerAdmin) && MoneroLikeConfiguration.MoneroLikeConfigurationItems.Any()) { - Monero + Monero } diff --git a/BTCPayServer/Views/Shared/Monero/StoreWalletsNavMoneroExtension.cshtml b/BTCPayServer/Views/Shared/Monero/StoreWalletsNavMoneroExtension.cshtml index 38ffd4c42..2160f8ef7 100644 --- a/BTCPayServer/Views/Shared/Monero/StoreWalletsNavMoneroExtension.cshtml +++ b/BTCPayServer/Views/Shared/Monero/StoreWalletsNavMoneroExtension.cshtml @@ -3,18 +3,20 @@ @using Microsoft.AspNetCore.Mvc.TagHelpers @using BTCPayServer.Client @using BTCPayServer.Abstractions.TagHelpers +@using BTCPayServer.Abstractions.Contracts @inject MoneroLikeConfiguration MoneroLikeConfiguration; +@inject IScopeProvider ScopeProvider @{ - var controller = ViewContext.RouteData.Values["Controller"].ToString(); - var isMonero = nameof(UIMoneroLikeStoreController).StartsWith(controller, StringComparison.InvariantCultureIgnoreCase); + var storeId = ScopeProvider.GetCurrentStoreId(); + var isActive = !string.IsNullOrEmpty(storeId) && ViewContext.RouteData.Values.TryGetValue("Controller", out var controller) && controller is not null && + nameof(UIMoneroLikeStoreController).StartsWith(controller.ToString() ?? string.Empty, StringComparison.InvariantCultureIgnoreCase); } @if (MoneroLikeConfiguration.MoneroLikeConfigurationItems.Any()) { } diff --git a/BTCPayServer/Views/Shared/Zcash/StoreNavZcashExtension.cshtml b/BTCPayServer/Views/Shared/Zcash/StoreNavZcashExtension.cshtml index 2a025c707..9761c1b73 100644 --- a/BTCPayServer/Views/Shared/Zcash/StoreNavZcashExtension.cshtml +++ b/BTCPayServer/Views/Shared/Zcash/StoreNavZcashExtension.cshtml @@ -1,12 +1,16 @@ @using BTCPayServer.Services.Altcoins.Zcash.Configuration @using BTCPayServer.Services.Altcoins.Zcash.UI +@using Microsoft.AspNetCore.Mvc.TagHelpers +@using BTCPayServer.Abstractions.Contracts @inject SignInManager SignInManager; @inject ZcashLikeConfiguration ZcashLikeConfiguration; +@inject IScopeProvider ScopeProvider @{ - var controller = ViewContext.RouteData.Values["Controller"].ToString(); - var isZcash = controller.Equals(nameof(UIZcashLikeStoreController), StringComparison.InvariantCultureIgnoreCase); + var storeId = ScopeProvider.GetCurrentStoreId(); + var isActive = !string.IsNullOrEmpty(storeId) && ViewContext.RouteData.Values.TryGetValue("Controller", out var controller) && controller is not null && + nameof(UIZcashLikeStoreController).StartsWith(controller.ToString() ?? string.Empty, StringComparison.InvariantCultureIgnoreCase); } @if (SignInManager.IsSignedIn(User) && User.IsInRole(Roles.ServerAdmin) && ZcashLikeConfiguration.ZcashLikeConfigurationItems.Any()) { - Zcash + Zcash }