diff --git a/BTCPayServer/Controllers/UIStoresController.EmailRules.cs b/BTCPayServer/Controllers/UIStoresController.EmailRules.cs index 48087647e..5a66d0b22 100644 --- a/BTCPayServer/Controllers/UIStoresController.EmailRules.cs +++ b/BTCPayServer/Controllers/UIStoresController.EmailRules.cs @@ -19,11 +19,6 @@ namespace BTCPayServer.Controllers { public partial class UIStoresController { - private void setupBitcoinWalletTransactions() - { - ViewData["BitcoinWalletTransactions"] = _callbackGenerator.WalletTransactionsLink(HttpContext.GetStoreData().Id, "BTC", Request); - } - [HttpGet("{storeId}/emails/rules")] public async Task StoreEmailRulesList(string storeId) { @@ -49,7 +44,6 @@ namespace BTCPayServer.Controllers [Authorize(Policy = Policies.CanModifyStoreSettings, AuthenticationSchemes = AuthenticationSchemes.Cookie)] public IActionResult StoreEmailRulesCreate(string storeId) { - setupBitcoinWalletTransactions(); return View("StoreEmailRulesManage", new StoreEmailRule()); } @@ -57,8 +51,6 @@ namespace BTCPayServer.Controllers [Authorize(Policy = Policies.CanModifyStoreSettings, AuthenticationSchemes = AuthenticationSchemes.Cookie)] public async Task StoreEmailRulesCreate(string storeId, StoreEmailRule model) { - setupBitcoinWalletTransactions(); - if (!ModelState.IsValid) return View("StoreEmailRulesManage", model); @@ -93,8 +85,6 @@ namespace BTCPayServer.Controllers var rules = store.GetStoreBlob().EmailRules; if (rules == null || ruleIndex >= rules.Count) return NotFound(); - setupBitcoinWalletTransactions(); - var rule = rules[ruleIndex]; return View("StoreEmailRulesManage", rule); } @@ -103,7 +93,6 @@ namespace BTCPayServer.Controllers [Authorize(Policy = Policies.CanModifyStoreSettings, AuthenticationSchemes = AuthenticationSchemes.Cookie)] public async Task StoreEmailRulesEdit(string storeId, int ruleIndex, StoreEmailRule model) { - setupBitcoinWalletTransactions(); if (!ModelState.IsValid) return View("StoreEmailRulesManage", model); diff --git a/BTCPayServer/Services/CallbackGenerator.cs b/BTCPayServer/Services/CallbackGenerator.cs index 969e37826..95271c4e9 100644 --- a/BTCPayServer/Services/CallbackGenerator.cs +++ b/BTCPayServer/Services/CallbackGenerator.cs @@ -81,13 +81,12 @@ namespace BTCPayServer.Services private Exception Bug([CallerMemberName] string? name = null) => new InvalidOperationException($"Error generating link for {name} (Report this bug to BTCPay Server github repository)"); - public string WalletTransactionsLink(string storeId, string cryptoCode, HttpRequest request) + public string WalletTransactionsLink(WalletId walletId, HttpRequest request) { - var walletId = new WalletId(storeId, cryptoCode); return LinkGenerator.GetUriByAction( action: nameof(UIWalletsController.WalletTransactions), controller: "UIWallets", - values: new { walletId }, + values: new { walletId = walletId.ToString() }, scheme: request.Scheme, host: request.Host, pathBase: request.PathBase diff --git a/BTCPayServer/Views/UIStores/StoreEmailRulesManage.cshtml b/BTCPayServer/Views/UIStores/StoreEmailRulesManage.cshtml index 3b8dac350..a27c10dad 100644 --- a/BTCPayServer/Views/UIStores/StoreEmailRulesManage.cshtml +++ b/BTCPayServer/Views/UIStores/StoreEmailRulesManage.cshtml @@ -1,13 +1,15 @@ @using BTCPayServer.HostedServices.Webhooks +@using BTCPayServer.Services @using Microsoft.AspNetCore.Mvc.TagHelpers @model BTCPayServer.Controllers.UIStoresController.StoreEmailRule @inject WebhookSender WebhookSender +@inject CallbackGenerator CallbackGenerator @{ var storeId = Context.GetStoreData().Id; bool isEdit = Model.Trigger != null; ViewData.SetActivePage(StoreNavPages.Emails, StringLocalizer[isEdit ? "Edit Email Rule" : "Create Email Rule"], storeId); - var bitcoinWalletTransactions = ViewData["BitcoinWalletTransactions"]?.ToString() ?? ""; + var bitcoinWalletTransactions = CallbackGenerator.WalletTransactionsLink(new (storeId, "BTC"), this.Context.Request); } @section PageHeadContent {