From a7b6f3fa196c545cc4f9b1df34c1ffa07a4cdbab Mon Sep 17 00:00:00 2001 From: Umar Bolatov Date: Mon, 11 Jul 2022 23:18:08 -0700 Subject: [PATCH] Redirect to dashboard instead of apps list on app delete (#3941) close #3898 --- BTCPayServer.Tests/CrowdfundTests.cs | 3 ++- BTCPayServer.Tests/UnitTest1.cs | 3 ++- BTCPayServer/Controllers/UIAppsController.cs | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/BTCPayServer.Tests/CrowdfundTests.cs b/BTCPayServer.Tests/CrowdfundTests.cs index f416100dc..64d8d3060 100644 --- a/BTCPayServer.Tests/CrowdfundTests.cs +++ b/BTCPayServer.Tests/CrowdfundTests.cs @@ -32,6 +32,7 @@ namespace BTCPayServer.Tests await user.GrantAccessAsync(); var user2 = tester.NewAccount(); await user2.GrantAccessAsync(); + var stores = user.GetController(); var apps = user.GetController(); var apps2 = user2.GetController(); var vm = Assert.IsType(Assert.IsType(apps.CreateApp(user.StoreId)).Model); @@ -56,7 +57,7 @@ namespace BTCPayServer.Tests Assert.IsType(apps2.DeleteApp(appList.Apps[0].Id)); Assert.IsType(apps.DeleteApp(appList.Apps[0].Id)); redirectToAction = Assert.IsType(apps.DeleteAppPost(appList.Apps[0].Id).Result); - Assert.Equal(nameof(apps.ListApps), redirectToAction.ActionName); + Assert.Equal(nameof(stores.Dashboard), redirectToAction.ActionName); appList = await apps.ListApps(user.StoreId).AssertViewModelAsync(); Assert.Empty(appList.Apps); } diff --git a/BTCPayServer.Tests/UnitTest1.cs b/BTCPayServer.Tests/UnitTest1.cs index 37dfbf644..b0c93b328 100644 --- a/BTCPayServer.Tests/UnitTest1.cs +++ b/BTCPayServer.Tests/UnitTest1.cs @@ -1950,6 +1950,7 @@ namespace BTCPayServer.Tests await user.GrantAccessAsync(); var user2 = tester.NewAccount(); await user2.GrantAccessAsync(); + var stores = user.GetController(); var apps = user.GetController(); var apps2 = user2.GetController(); var vm = Assert.IsType(Assert.IsType(apps.CreateApp(user.StoreId)).Model); @@ -1974,7 +1975,7 @@ namespace BTCPayServer.Tests Assert.IsType(apps2.DeleteApp(appList.Apps[0].Id)); Assert.IsType(apps.DeleteApp(appList.Apps[0].Id)); redirectToAction = Assert.IsType(apps.DeleteAppPost(appList.Apps[0].Id).Result); - Assert.Equal(nameof(apps.ListApps), redirectToAction.ActionName); + Assert.Equal(nameof(stores.Dashboard), redirectToAction.ActionName); appList = Assert.IsType(Assert.IsType(apps.ListApps(user.StoreId).Result).Model); Assert.Empty(appList.Apps); } diff --git a/BTCPayServer/Controllers/UIAppsController.cs b/BTCPayServer/Controllers/UIAppsController.cs index 8499e8f6c..f756de46c 100644 --- a/BTCPayServer/Controllers/UIAppsController.cs +++ b/BTCPayServer/Controllers/UIAppsController.cs @@ -164,7 +164,7 @@ namespace BTCPayServer.Controllers if (await _appService.DeleteApp(app)) TempData[WellKnownTempData.SuccessMessage] = "App deleted successfully."; - return RedirectToAction(nameof(ListApps), new { storeId = app.StoreDataId }); + return RedirectToAction(nameof(UIStoresController.Dashboard), "UIStores", new { storeId = app.StoreDataId }); } async Task GetStoreDefaultCurrentIfEmpty(string storeId, string currency)