From 17d8717f0952a5f5992441932ce8ef69ba63d138 Mon Sep 17 00:00:00 2001 From: Jared Goodwin Date: Wed, 19 May 2021 14:33:21 -0700 Subject: [PATCH] Cascade from user org name to default org name to "Remotely". --- Server/Pages/Shared/_Layout.cshtml | 29 ++++++++++++++++++----------- Server/Shared/NavMenu.razor | 15 +++++++++++++-- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/Server/Pages/Shared/_Layout.cshtml b/Server/Pages/Shared/_Layout.cshtml index 56f05a858..392d5e034 100644 --- a/Server/Pages/Shared/_Layout.cshtml +++ b/Server/Pages/Shared/_Layout.cshtml @@ -1,14 +1,28 @@ @using Microsoft.AspNetCore.Hosting @using Microsoft.AspNetCore.Mvc.ViewEngines -@using Remotely.Server.Services +@using Remotely.Server.Services @using Remotely.Shared.Models -@inject IApplicationConfig AppConfig +@inject IApplicationConfig AppConfig @inject IWebHostEnvironment Environment @inject ICompositeViewEngine Engine -@inject IDataService DataService +@inject IDataService DataService @{ + var organizationName = "Remotely"; var user = DataService.GetUserByNameWithOrg(User?.Identity?.Name); + + if (user is null) + { + var defaultOrg = await DataService.GetDefaultOrganization(); + if (!string.IsNullOrWhiteSpace(defaultOrg?.OrganizationName)) + { + organizationName = defaultOrg.OrganizationName; + } + } + else if (!string.IsNullOrWhiteSpace(user.Organization?.OrganizationName)) + { + organizationName = user.Organization.OrganizationName; + } } @@ -63,14 +77,7 @@
- @if (!string.IsNullOrWhiteSpace(user?.Organization?.OrganizationName)) - { - @user.Organization.OrganizationName - } - else - { - @Html.Raw("Remotely") - } + @organizationName
Support Portal
diff --git a/Server/Shared/NavMenu.razor b/Server/Shared/NavMenu.razor index da05bd4b9..3edaacd34 100644 --- a/Server/Shared/NavMenu.razor +++ b/Server/Shared/NavMenu.razor @@ -5,9 +5,9 @@