Skip to content

Commit

Permalink
Merge pull request #3705 from sbwalker/dev
Browse files Browse the repository at this point in the history
remove unnecessary database call to GetSettings()
  • Loading branch information
sbwalker authored Jan 31, 2024
2 parents 4c706a2 + 5e82700 commit 951071e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Oqtane.Server/Components/App.razor
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
@using Oqtane.Models
@using Oqtane.Shared
@using Oqtane.Themes
@using Oqtane.Extensions
@inject NavigationManager NavigationManager
@inject IAntiforgery Antiforgery
@inject IConfigManager ConfigManager
Expand All @@ -27,7 +28,6 @@
@inject ILocalizationManager LocalizationManager
@inject IAliasRepository AliasRepository
@inject IUrlMappingRepository UrlMappingRepository
@inject ISettingRepository SettingRepository
@inject IVisitorRepository VisitorRepository

<!DOCTYPE html>
Expand Down Expand Up @@ -299,10 +299,10 @@

// filter
string filter = Constants.DefaultVisitorFilter;
var settings = SettingRepository.GetSettings(EntityNames.Site, SiteId);
if (settings.Any(item => item.SettingName == "VisitorFilter"))
var settings = Context.GetSiteSettings();
if (settings.ContainsKey("VisitorFilter") && !string.IsNullOrEmpty(settings["VisitorFilter"]))
{
filter = settings.First(item => item.SettingName == "VisitorFilter").SettingValue;
filter = settings["VisitorFilter"];
}
foreach (string term in filter.ToLower().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(sValue => sValue.Trim()).ToArray())
{
Expand Down Expand Up @@ -330,9 +330,9 @@
// if enabled use IP Address correlation
_visitorId = -1;
bool correlate = true;
if (settings.Any(item => item.SettingName == "VisitorCorrelation"))
if (settings.ContainsKey("VisitorCorrelation") && !string.IsNullOrEmpty(settings["VisitorCorrelation"]))
{
correlate = bool.Parse(settings.First(item => item.SettingName == "VisitorCorrelation").SettingValue);
correlate = bool.Parse(settings["VisitorCorrelation"]);
}
if (correlate)
{
Expand Down

0 comments on commit 951071e

Please sign in to comment.