Small nits

This commit is contained in:
nicolas.dorier
2025-03-27 16:08:15 +09:00
parent 0cba392988
commit 631a0a22b5
3 changed files with 5 additions and 15 deletions

View File

@@ -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<IActionResult> 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<IActionResult> 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<IActionResult> StoreEmailRulesEdit(string storeId, int ruleIndex, StoreEmailRule model)
{
setupBitcoinWalletTransactions();
if (!ModelState.IsValid)
return View("StoreEmailRulesManage", model);

View File

@@ -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

View File

@@ -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 {