Merge pull request #3867 from thabaum/site-settings-savesite-reload

Fixes #3863 - Site Settings: Always reload the page on SaveSite()
This commit is contained in:
Shaun Walker 2024-02-21 15:55:07 -05:00 committed by GitHub
commit 6e267b8825
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -579,9 +579,6 @@
var site = await SiteService.GetSiteAsync(PageState.Site.SiteId); var site = await SiteService.GetSiteAsync(PageState.Site.SiteId);
if (site != null) if (site != null)
{ {
bool refresh = false;
bool reload = false;
site.Name = _name; site.Name = _name;
site.HomePageId = (_homepageid != "-" ? int.Parse(_homepageid) : null); site.HomePageId = (_homepageid != "-" ? int.Parse(_homepageid) : null);
site.IsDeleted = (_isdeleted == null ? true : Boolean.Parse(_isdeleted)); site.IsDeleted = (_isdeleted == null ? true : Boolean.Parse(_isdeleted));
@ -595,7 +592,6 @@
if (logofileid != _logofileid) if (logofileid != _logofileid)
{ {
_logofileid = logofileid; _logofileid = logofileid;
refresh = true; // needs to be refreshed on client
} }
} }
int? faviconFieldId = _faviconfilemanager.GetFileId(); int? faviconFieldId = _faviconfilemanager.GetFileId();
@ -603,17 +599,14 @@
if (site.FaviconFileId != faviconFieldId) if (site.FaviconFileId != faviconFieldId)
{ {
site.FaviconFileId = faviconFieldId; site.FaviconFileId = faviconFieldId;
reload = true; // needs to be reloaded on server
} }
if (site.DefaultThemeType != _themetype) if (site.DefaultThemeType != _themetype)
{ {
site.DefaultThemeType = _themetype; site.DefaultThemeType = _themetype;
refresh = true; // needs to be refreshed on client
} }
if (site.DefaultContainerType != _containertype) if (site.DefaultContainerType != _containertype)
{ {
site.DefaultContainerType = _containertype; site.DefaultContainerType = _containertype;
refresh = true; // needs to be refreshed on client
} }
site.AdminContainerType = _admincontainertype; site.AdminContainerType = _admincontainertype;
@ -621,33 +614,28 @@
if (site.HeadContent != _headcontent) if (site.HeadContent != _headcontent)
{ {
site.HeadContent = _headcontent; site.HeadContent = _headcontent;
reload = true;
} }
if (site.BodyContent != _bodycontent) if (site.BodyContent != _bodycontent)
{ {
site.BodyContent = _bodycontent; site.BodyContent = _bodycontent;
reload = true;
} }
// PWA // PWA
if (site.PwaIsEnabled.ToString() != _pwaisenabled) if (site.PwaIsEnabled.ToString() != _pwaisenabled)
{ {
site.PwaIsEnabled = Boolean.Parse(_pwaisenabled); site.PwaIsEnabled = Boolean.Parse(_pwaisenabled);
reload = true; // needs to be reloaded on server
} }
int? pwaappiconfileid = _pwaappiconfilemanager.GetFileId(); int? pwaappiconfileid = _pwaappiconfilemanager.GetFileId();
if (pwaappiconfileid == -1) pwaappiconfileid = null; if (pwaappiconfileid == -1) pwaappiconfileid = null;
if (site.PwaAppIconFileId != pwaappiconfileid) if (site.PwaAppIconFileId != pwaappiconfileid)
{ {
site.PwaAppIconFileId = pwaappiconfileid; site.PwaAppIconFileId = pwaappiconfileid;
reload = true; // needs to be reloaded on server
} }
int? pwasplashiconfileid = _pwasplashiconfilemanager.GetFileId(); int? pwasplashiconfileid = _pwasplashiconfilemanager.GetFileId();
if (pwasplashiconfileid == -1) pwasplashiconfileid = null; if (pwasplashiconfileid == -1) pwasplashiconfileid = null;
if (site.PwaSplashIconFileId != pwasplashiconfileid) if (site.PwaSplashIconFileId != pwasplashiconfileid)
{ {
site.PwaSplashIconFileId = pwasplashiconfileid; site.PwaSplashIconFileId = pwasplashiconfileid;
reload = true; // needs to be reloaded on server
} }
// hosting model // hosting model
@ -659,7 +647,6 @@
site.Runtime = _runtime; site.Runtime = _runtime;
site.Prerender = bool.Parse(_prerender); site.Prerender = bool.Parse(_prerender);
site.Hybrid = bool.Parse(_hybrid); site.Hybrid = bool.Parse(_hybrid);
reload = true; // needs to be reloaded on serve
} }
} }
@ -686,15 +673,7 @@
await logger.LogInformation("Site Settings Saved {Site}", site); await logger.LogInformation("Site Settings Saved {Site}", site);
if (refresh || reload) NavigationManager.NavigateTo(NavigateUrl(), true); // reload
{
NavigationManager.NavigateTo(NavigateUrl(true), reload); // refresh/reload
}
else
{
AddModuleMessage(Localizer["Success.Settings.SaveSite"], MessageType.Success);
await ScrollToPageTop();
}
} }
} }
else else