From 01a5b050149433d27b135a0216b93a6c564e1fd3 Mon Sep 17 00:00:00 2001 From: Dariusz Szut Date: Tue, 31 Oct 2023 14:57:06 +0100 Subject: [PATCH] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ɓukasz Ostafin --- .../public/js/scripts/admin.search.autocomplete.content.js | 6 +++--- .../public/js/scripts/admin.search.autocomplete.js | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/bundle/Resources/public/js/scripts/admin.search.autocomplete.content.js b/src/bundle/Resources/public/js/scripts/admin.search.autocomplete.content.js index 659d9c0e90..46f99794aa 100644 --- a/src/bundle/Resources/public/js/scripts/admin.search.autocomplete.content.js +++ b/src/bundle/Resources/public/js/scripts/admin.search.autocomplete.content.js @@ -7,7 +7,7 @@ const { escapeHTML } = ibexa.helpers.text; const { highlightText } = ibexa.helpers.highlight; - const contentTypeHelper = ibexa.helpers.contentType; + const { getContentTypeIconUrl, getContentTypeName } = ibexa.helpers.contentType; const autocompleteListNode = globalSearch.querySelector('.ibexa-global-search__autocomplete-list'); const autocompleteContentTemplateNode = globalSearch.querySelector('.ibexa-global-search__autocomplete-content-template'); const renderItem = (result, searchText) => { @@ -28,8 +28,8 @@ const autocompleteHighlightTemplate = autocompleteListNode.dataset.templateHighlight; const renderedTemplate = autocompleteItemTemplate .replace('{{ contentName }}', highlightText(searchText, name, autocompleteHighlightTemplate)) - .replace('{{ iconHref }}', contentTypeHelper.getContentTypeIconUrl(contentTypeIdentifier)) - .replace('{{ contentTypeName }}', escapeHTML(contentTypeHelper.getContentTypeName(contentTypeIdentifier))) + .replace('{{ iconHref }}', getContentTypeIconUrl(contentTypeIdentifier)) + .replace('{{ contentTypeName }}', escapeHTML(getContentTypeName(contentTypeIdentifier))) .replaceAll('{{ contentBreadcrumbs }}', breadcrumb) .replace('{{ contentHref }}', Routing.generate('ibexa.content.view', { contentId, locationId })); diff --git a/src/bundle/Resources/public/js/scripts/admin.search.autocomplete.js b/src/bundle/Resources/public/js/scripts/admin.search.autocomplete.js index cc86a3c92c..034fef0a37 100644 --- a/src/bundle/Resources/public/js/scripts/admin.search.autocomplete.js +++ b/src/bundle/Resources/public/js/scripts/admin.search.autocomplete.js @@ -52,6 +52,7 @@ credentials: 'same-origin', }); searchAbortController = new AbortController(); + const { signal } = searchAbortController; fetch(request, { signal })