From b0b8f583d2e4903a481ff34973ca3c007cd32e4b Mon Sep 17 00:00:00 2001 From: Zac-AND-Digital Date: Thu, 23 Jan 2025 16:40:44 +0000 Subject: [PATCH] refactor: wrap logic into method --- .../Pages/ProfessionalReferral/LocalOfferDetail.cshtml.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ui/connect-ui/src/FamilyHubs.Referral.Web/Pages/ProfessionalReferral/LocalOfferDetail.cshtml.cs b/src/ui/connect-ui/src/FamilyHubs.Referral.Web/Pages/ProfessionalReferral/LocalOfferDetail.cshtml.cs index 1d2526031..3c79cc088 100644 --- a/src/ui/connect-ui/src/FamilyHubs.Referral.Web/Pages/ProfessionalReferral/LocalOfferDetail.cshtml.cs +++ b/src/ui/connect-ui/src/FamilyHubs.Referral.Web/Pages/ProfessionalReferral/LocalOfferDetail.cshtml.cs @@ -2,7 +2,6 @@ using FamilyHubs.ServiceDirectory.Shared.Dto; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Primitives; -using Microsoft.AspNetCore.Authorization; using FamilyHubs.Referral.Web.Pages.Shared; using FamilyHubs.SharedKernel.Identity; using FamilyHubs.ServiceDirectory.Shared.Enums; @@ -44,9 +43,7 @@ public async Task OnGetAsync(string serviceId) ReturnUrl = StringValues.IsNullOrEmpty(referer) ? Url.Page("Search") : referer.ToString(); LocalOffer = await _organisationClientService.GetLocalOfferById(serviceId); - if (!await _featureManager.IsEnabledAsync(FeatureFlag.VcfsServices) - && - LocalOffer.ServiceType == ServiceType.InformationSharing) + if (await ShouldDisableServiceDetailPage()) { return RedirectToPage("/Error/404"); } @@ -84,6 +81,9 @@ public async Task OnGetAsync(string serviceId) return (serviceScheduleAttendingTypes, LocalOffer.Schedules.FirstOrDefault()); } + private async Task ShouldDisableServiceDetailPage() => + !await _featureManager.IsEnabledAsync(FeatureFlag.VcfsServices) && LocalOffer.ServiceType == ServiceType.InformationSharing; + private async Task ShouldShowConnectionRequestButton() { if (! await _featureManager.IsEnabledAsync(FeatureFlag.ConnectDashboard))