Skip to content

Commit 51d9b6d

Browse files
authored
Merge pull request #2070 from TechnologyEnhancedLearning/Develop/Fixes/TD-1944_Fixed_showing_console_404_error_instead_of_410_error
TD-1944 Fixed false console error showing when clicking browser back …
2 parents 5f8ada4 + b256b05 commit 51d9b6d

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace DigitalLearningSolutions.Data.Enums
2+
{
3+
public enum ViewDelegateNavigationType
4+
{
5+
PromoteToAdmin
6+
}
7+
}

DigitalLearningSolutions.Web.Tests/Controllers/TrackingSystem/Delegates/ViewDelegateControllerTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public void Index_shows_centre_specific_email_if_not_null()
6767
A.CallTo(() => userService.GetDelegateById(delegateId)).Returns(delegateEntity);
6868

6969
// When
70-
var result = viewDelegateController.Index(delegateId);
70+
var result = viewDelegateController.Index(delegateId, null);
7171

7272
// Then
7373
result.As<ViewResult>().Model.As<ViewDelegateViewModel>().DelegateInfo.Email.Should()
@@ -83,7 +83,7 @@ public void Index_shows_primary_email_if_centre_specific_email_is_null()
8383
A.CallTo(() => userService.GetDelegateById(delegateId)).Returns(delegateEntity);
8484

8585
// When
86-
var result = viewDelegateController.Index(delegateId);
86+
var result = viewDelegateController.Index(delegateId, null);
8787

8888
// Then
8989
result.As<ViewResult>().Model.As<ViewDelegateViewModel>().DelegateInfo.Email.Should()
@@ -98,7 +98,7 @@ public void Index_returns_not_found_result_if_no_delegate_found_with_given_id()
9898
A.CallTo(() => userService.GetDelegateById(delegateId)).Returns(null);
9999

100100
// When
101-
var result = viewDelegateController.Index(delegateId);
101+
var result = viewDelegateController.Index(delegateId, null);
102102

103103
// Then
104104
result.Should().BeNotFoundResult();

DigitalLearningSolutions.Web/Controllers/TrackingSystem/Delegates/PromoteToAdminController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public IActionResult Index(AdminRolesFormData formData, int delegateId)
173173
return new StatusCodeResult(500);
174174
}
175175
TempData["IsDelegatePromoted"] = true;
176-
return RedirectToAction("Index", "ViewDelegate", new { delegateId });
176+
return RedirectToAction("Index", "ViewDelegate", new { delegateId = delegateId, callType = ViewDelegateNavigationType.PromoteToAdmin });
177177
}
178178
}
179179
}

DigitalLearningSolutions.Web/Controllers/TrackingSystem/Delegates/ViewDelegateController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ IEmailVerificationDataService emailVerificationDataService
5757
this.emailVerificationDataService = emailVerificationDataService;
5858
}
5959

60-
public IActionResult Index(int delegateId)
60+
public IActionResult Index(int delegateId, string? callType)
6161
{
6262
var centreId = User.GetCentreIdKnownNotNull();
6363

@@ -68,7 +68,7 @@ public IActionResult Index(int delegateId)
6868
return NotFound();
6969
}
7070

71-
if (TempData["IsDelegatePromoted"] != null)
71+
if (string.IsNullOrEmpty(callType) && TempData["IsDelegatePromoted"] != null)
7272
{
7373
TempData.Remove("IsDelegatePromoted");
7474
}

0 commit comments

Comments
 (0)