diff --git a/BTCPayServer/Controllers/WalletsController.cs b/BTCPayServer/Controllers/WalletsController.cs index 921cc45f7..cfe1a14ff 100644 --- a/BTCPayServer/Controllers/WalletsController.cs +++ b/BTCPayServer/Controllers/WalletsController.cs @@ -307,7 +307,7 @@ namespace BTCPayServer.Controllers [HttpGet] [Route("{walletId}/receive")] public IActionResult WalletReceive([ModelBinder(typeof(WalletIdModelBinder))] - WalletId walletId, string statusMessage = null) + WalletId walletId) { if (walletId?.StoreId == null) return NotFound(); @@ -319,11 +319,6 @@ namespace BTCPayServer.Controllers return NotFound(); var address = _WalletReceiveStateService.Get(walletId)?.Address; - if (!string.IsNullOrEmpty(statusMessage)) - { - TempData[WellKnownTempData.SuccessMessage] = statusMessage; - } - return View(new WalletReceiveViewModel() { CryptoCode = walletId.CryptoCode, @@ -345,7 +340,6 @@ namespace BTCPayServer.Controllers var network = this.NetworkProvider.GetNetwork(walletId?.CryptoCode); if (network == null) return NotFound(); - var statusMessage = string.Empty; var wallet = _walletProvider.GetWallet(network); switch (command) { @@ -358,12 +352,12 @@ namespace BTCPayServer.Controllers var address = cachedAddress.ScriptPubKey.GetDestinationAddress(network.NBitcoinNetwork); ExplorerClientProvider.GetExplorerClient(network) .CancelReservation(cachedAddress.DerivationStrategy, new[] {cachedAddress.KeyPath}); - statusMessage = new StatusMessageModel() + this.TempData.SetStatusMessageModel(new StatusMessageModel() { - AllowDismiss =true, + AllowDismiss = true, Message = $"Address {address} was unreserved.", Severity = StatusMessageModel.StatusSeverity.Success, - }.ToString(); + }); _WalletReceiveStateService.Remove(walletId); break; case "generate-new-address": @@ -371,7 +365,7 @@ namespace BTCPayServer.Controllers _WalletReceiveStateService.Set(walletId, reserve); break; } - return RedirectToAction(nameof(WalletReceive), new {walletId, statusMessage}); + return RedirectToAction(nameof(WalletReceive), new {walletId}); } [HttpGet] diff --git a/BTCPayServer/Views/Wallets/WalletReceive.cshtml b/BTCPayServer/Views/Wallets/WalletReceive.cshtml index 8caa19db4..44e3a5c55 100644 --- a/BTCPayServer/Views/Wallets/WalletReceive.cshtml +++ b/BTCPayServer/Views/Wallets/WalletReceive.cshtml @@ -5,13 +5,20 @@ ViewData["Title"] = "Manage wallet"; ViewData.SetActivePageAndTitle(WalletsNavPages.Receive); } - +@if (TempData.HasStatusMessage()) +{ +
+
+ +
+
+}
@if (string.IsNullOrEmpty(Model.Address)) { - +

Receive @Model.CryptoCode

} @@ -21,14 +28,14 @@
@@ -38,17 +45,17 @@
- +
- - + +
} - +
@@ -56,7 +63,7 @@ @section HeadScripts { - + - + + .copy { + cursor: copy; + } + }