Skip to content

Commit

Permalink
Merge pull request #4372 from sbwalker/dev
Browse files Browse the repository at this point in the history
provide default Permissions value
  • Loading branch information
sbwalker authored Jun 28, 2024
2 parents 9901816 + 7f6a08a commit 1eafed7
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions Oqtane.Server/Managers/Search/ModuleSearchIndexManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ private void SaveModuleMetaData(SearchContent searchContent, PageModule pageModu
searchContent.EntityId = pageModule.ModuleId.ToString();
}

if (string.IsNullOrEmpty(searchContent.Permissions))
{
searchContent.Permissions = $"{EntityNames.Module}:{pageModule.ModuleId},{EntityNames.Page}:{pageModule.PageId}";
}

if (searchContent.ContentModifiedOn == DateTime.MinValue)
{
Expand All @@ -111,16 +115,17 @@ private void SaveModuleMetaData(SearchContent searchContent, PageModule pageModu
searchContent.AdditionalContent = string.Empty;
}

var page = _pageRepository.GetPage(pageModule.PageId);

if (string.IsNullOrEmpty(searchContent.Url) && page != null)
if (pageModule.Page != null)
{
searchContent.Url = $"{(!string.IsNullOrEmpty(page.Path) && !page.Path.StartsWith("/") ? "/" : "")}{page.Path}";
}
if (string.IsNullOrEmpty(searchContent.Url))
{
searchContent.Url = $"{(!string.IsNullOrEmpty(pageModule.Page.Path) && !pageModule.Page.Path.StartsWith("/") ? "/" : "")}{pageModule.Page.Path}";
}

if (string.IsNullOrEmpty(searchContent.Title) && page != null)
{
searchContent.Title = !string.IsNullOrEmpty(page.Title) ? page.Title : page.Name;
if (string.IsNullOrEmpty(searchContent.Title))
{
searchContent.Title = !string.IsNullOrEmpty(pageModule.Page.Title) ? pageModule.Page.Title : pageModule.Page.Name;
}
}

if (searchContent.SearchContentProperties == null)
Expand Down

0 comments on commit 1eafed7

Please sign in to comment.