diff --git a/DigitalLearningSolutions.Web/Controllers/UserFeedbackController.cs b/DigitalLearningSolutions.Web/Controllers/UserFeedbackController.cs index 433602bcb0..a788792953 100644 --- a/DigitalLearningSolutions.Web/Controllers/UserFeedbackController.cs +++ b/DigitalLearningSolutions.Web/Controllers/UserFeedbackController.cs @@ -52,6 +52,13 @@ public IActionResult Index(string sourceUrl, string sourcePageTitle) TaskRating = null, }; + if(sourcePageTitle == "Digital Learning Solutions - Page no longer available") + { + var url = ContentUrlHelper.ReplaceUrlSegment(sourceUrl); + _userFeedbackViewModel.SourceUrl = url; + _userFeedbackViewModel.SourcePageTitle = "Welcome"; + } + if (_userFeedbackViewModel.UserId == null || _userFeedbackViewModel.UserId == 0) { return GuestFeedbackStart(_userFeedbackViewModel); diff --git a/DigitalLearningSolutions.Web/Helpers/ContentUrlHelper.cs b/DigitalLearningSolutions.Web/Helpers/ContentUrlHelper.cs index 0b471efe17..f20caec3ab 100644 --- a/DigitalLearningSolutions.Web/Helpers/ContentUrlHelper.cs +++ b/DigitalLearningSolutions.Web/Helpers/ContentUrlHelper.cs @@ -22,5 +22,17 @@ public static string GetContentPath(IConfiguration config, string videoPath) public static string? GetNullableContentPath(IConfiguration config, string? videoPath) => videoPath != null ? GetContentPath(config, videoPath) : null; + + public static string ReplaceUrlSegment(string sourceUrl) + { + string errorSegment = "LearningSolutions/StatusCode/410"; + string welcomeSegment = "Home/Welcome"; + + if (sourceUrl.Contains(errorSegment)) + { + return sourceUrl.Replace(errorSegment, welcomeSegment); + } + return sourceUrl; + } } }