Skip to content

Commit

Permalink
Merge branch '17.x.x' into aria17
Browse files Browse the repository at this point in the history
  • Loading branch information
ichim-david authored Mar 29, 2024
2 parents 60ad089 + e1274a9 commit 700d367
Show file tree
Hide file tree
Showing 27 changed files with 219 additions and 15 deletions.
61 changes: 61 additions & 0 deletions cypress/tests/core/blocks/blocks-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,4 +497,65 @@ describe('Search Block Tests', () => {
`Search results: ${results_number}`,
);
});

it('Search block - test on edit sort on and sort order', () => {
cy.visit('/');
cy.get('#toolbar-add > .icon').click();
cy.get('#toolbar-add-document').click();
cy.getSlateTitle().focus().click().type('My Search Page');

// Add Search listing block
cy.addNewBlock('search');

// Add search query criteria
cy.get('#default-query-0-query .react-select__value-container').click();
cy.get('#default-query-0-query .react-select__option')
.contains('Type')
.click();

cy.get('#default-query-0-query .fields:first-of-type > .field').click();
cy.get(
'#default-query-0-query .fields:first-of-type > .field .react-select__option',
)
.contains('Page')
.click();

cy.get('#default-query-0-query .fields:first-of-type > .field').click();
cy.get(
'#default-query-0-query .fields:first-of-type > .field .react-select__option',
)
.contains('Folder')
.click();

cy.get('#default-query-0-query .fields:first-of-type > .field').click();
cy.get(
'#default-query-0-query .fields:first-of-type > .field .react-select__option',
)
.contains('Event')
.click();

// uncheck showSearchButton
cy.get('label[for=field-showSearchButton]').click();
cy.get('.search-wrapper .ui.button').should('contain', 'Search');
// reverse order
cy.get('label[for=field-sort_order_boolean-2-query]').click();
//check if the sorting order is working
cy.get('.listing-item').first().contains('My Event');
cy.get('#select-listingblock-sort-on').click();
cy.get('.react-select__menu .react-select__group')
.first()
.children()
.first()
.next()
.children()
.first()
.next()
.click();
cy.wait(5000);

cy.get('.listing-item').first().contains('My page');
//save page
cy.get('#toolbar-save > .icon').click();
cy.wait(500);
});
});
9 changes: 2 additions & 7 deletions docs/source/robots.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
# Disallow all user agents from the following directories and files
User-agent: *
Disallow: /_sources/
Disallow: /.doctrees/
Disallow: /*.txt$
Disallow: /.buildinfo$
Disallow: /objects.inv$
# Disallow all user agents from indexing pages and links in the site on Netlify only.
Disallow: /
6 changes: 6 additions & 0 deletions locales/ca/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -3649,6 +3649,12 @@ msgstr ""
msgid "There are no users with the searched criteria"
msgstr ""

#. Default: "There are some errors."
#: components/manage/Add/Add
#: components/manage/Edit/Edit
msgid "There are some errors."
msgstr ""

#. Default: "There is a configuration problem on the backend"
#: components/theme/CorsError/CorsError
msgid "There is a configuration problem on the backend"
Expand Down
6 changes: 6 additions & 0 deletions locales/de/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -3648,6 +3648,12 @@ msgstr ""
msgid "There are no users with the searched criteria"
msgstr ""

#. Default: "There are some errors."
#: components/manage/Add/Add
#: components/manage/Edit/Edit
msgid "There are some errors."
msgstr ""

#. Default: "There is a configuration problem on the backend"
#: components/theme/CorsError/CorsError
msgid "There is a configuration problem on the backend"
Expand Down
6 changes: 6 additions & 0 deletions locales/en/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -3643,6 +3643,12 @@ msgstr ""
msgid "There are no users with the searched criteria"
msgstr ""

#. Default: "There are some errors."
#: components/manage/Add/Add
#: components/manage/Edit/Edit
msgid "There are some errors."
msgstr ""

#. Default: "There is a configuration problem on the backend"
#: components/theme/CorsError/CorsError
msgid "There is a configuration problem on the backend"
Expand Down
6 changes: 6 additions & 0 deletions locales/es/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -3650,6 +3650,12 @@ msgstr "No hay grupos con los criterios buscados."
msgid "There are no users with the searched criteria"
msgstr "No hay usuarios con los criterios buscados"

#. Default: "There are some errors."
#: components/manage/Add/Add
#: components/manage/Edit/Edit
msgid "There are some errors."
msgstr ""

#. Default: "There is a configuration problem on the backend"
#: components/theme/CorsError/CorsError
msgid "There is a configuration problem on the backend"
Expand Down
6 changes: 6 additions & 0 deletions locales/eu/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -3650,6 +3650,12 @@ msgstr ""
msgid "There are no users with the searched criteria"
msgstr ""

#. Default: "There are some errors."
#: components/manage/Add/Add
#: components/manage/Edit/Edit
msgid "There are some errors."
msgstr ""

#. Default: "There is a configuration problem on the backend"
#: components/theme/CorsError/CorsError
msgid "There is a configuration problem on the backend"
Expand Down
6 changes: 6 additions & 0 deletions locales/fi/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -3648,6 +3648,12 @@ msgstr ""
msgid "There are no users with the searched criteria"
msgstr ""

#. Default: "There are some errors."
#: components/manage/Add/Add
#: components/manage/Edit/Edit
msgid "There are some errors."
msgstr ""

#. Default: "There is a configuration problem on the backend"
#: components/theme/CorsError/CorsError
msgid "There is a configuration problem on the backend"
Expand Down
6 changes: 6 additions & 0 deletions locales/fr/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -3650,6 +3650,12 @@ msgstr ""
msgid "There are no users with the searched criteria"
msgstr ""

#. Default: "There are some errors."
#: components/manage/Add/Add
#: components/manage/Edit/Edit
msgid "There are some errors."
msgstr ""

#. Default: "There is a configuration problem on the backend"
#: components/theme/CorsError/CorsError
msgid "There is a configuration problem on the backend"
Expand Down
6 changes: 6 additions & 0 deletions locales/it/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -3643,6 +3643,12 @@ msgstr ""
msgid "There are no users with the searched criteria"
msgstr ""

#. Default: "There are some errors."
#: components/manage/Add/Add
#: components/manage/Edit/Edit
msgid "There are some errors."
msgstr ""

#. Default: "There is a configuration problem on the backend"
#: components/theme/CorsError/CorsError
msgid "There is a configuration problem on the backend"
Expand Down
6 changes: 6 additions & 0 deletions locales/ja/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -3648,6 +3648,12 @@ msgstr ""
msgid "There are no users with the searched criteria"
msgstr ""

#. Default: "There are some errors."
#: components/manage/Add/Add
#: components/manage/Edit/Edit
msgid "There are some errors."
msgstr ""

#. Default: "There is a configuration problem on the backend"
#: components/theme/CorsError/CorsError
msgid "There is a configuration problem on the backend"
Expand Down
6 changes: 6 additions & 0 deletions locales/nl/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -3647,6 +3647,12 @@ msgstr ""
msgid "There are no users with the searched criteria"
msgstr ""

#. Default: "There are some errors."
#: components/manage/Add/Add
#: components/manage/Edit/Edit
msgid "There are some errors."
msgstr ""

#. Default: "There is a configuration problem on the backend"
#: components/theme/CorsError/CorsError
msgid "There is a configuration problem on the backend"
Expand Down
6 changes: 6 additions & 0 deletions locales/pt/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -3648,6 +3648,12 @@ msgstr ""
msgid "There are no users with the searched criteria"
msgstr ""

#. Default: "There are some errors."
#: components/manage/Add/Add
#: components/manage/Edit/Edit
msgid "There are some errors."
msgstr ""

#. Default: "There is a configuration problem on the backend"
#: components/theme/CorsError/CorsError
msgid "There is a configuration problem on the backend"
Expand Down
6 changes: 6 additions & 0 deletions locales/pt_BR/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -3649,6 +3649,12 @@ msgstr ""
msgid "There are no users with the searched criteria"
msgstr ""

#. Default: "There are some errors."
#: components/manage/Add/Add
#: components/manage/Edit/Edit
msgid "There are some errors."
msgstr "Existem alguns erros."

#. Default: "There is a configuration problem on the backend"
#: components/theme/CorsError/CorsError
msgid "There is a configuration problem on the backend"
Expand Down
6 changes: 6 additions & 0 deletions locales/ro/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -3643,6 +3643,12 @@ msgstr ""
msgid "There are no users with the searched criteria"
msgstr ""

#. Default: "There are some errors."
#: components/manage/Add/Add
#: components/manage/Edit/Edit
msgid "There are some errors."
msgstr ""

#. Default: "There is a configuration problem on the backend"
#: components/theme/CorsError/CorsError
msgid "There is a configuration problem on the backend"
Expand Down
8 changes: 7 additions & 1 deletion locales/volto.pot
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: Plone\n"
"POT-Creation-Date: 2024-02-02T15:43:45.656Z\n"
"POT-Creation-Date: 2024-03-05T13:17:03.192Z\n"
"Last-Translator: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
"Language-Team: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
"Content-Type: text/plain; charset=utf-8\n"
Expand Down Expand Up @@ -3645,6 +3645,12 @@ msgstr ""
msgid "There are no users with the searched criteria"
msgstr ""

#. Default: "There are some errors."
#: components/manage/Add/Add
#: components/manage/Edit/Edit
msgid "There are some errors."
msgstr ""

#. Default: "There is a configuration problem on the backend"
#: components/theme/CorsError/CorsError
msgid "There is a configuration problem on the backend"
Expand Down
6 changes: 6 additions & 0 deletions locales/zh_CN/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -3649,6 +3649,12 @@ msgstr ""
msgid "There are no users with the searched criteria"
msgstr ""

#. Default: "There are some errors."
#: components/manage/Add/Add
#: components/manage/Edit/Edit
msgid "There are some errors."
msgstr ""

#. Default: "There is a configuration problem on the backend"
#: components/theme/CorsError/CorsError
msgid "There is a configuration problem on the backend"
Expand Down
4 changes: 4 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
NODE_VERSION = "16.17.1"
[build]
ignore = "git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF ./docs/"
[[headers]]
for = "/*"
[[headers.values]]
X-Robots-Tag = "none"
1 change: 1 addition & 0 deletions news/1868.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Show validation error message as string instead of list. @wesleybl
1 change: 1 addition & 0 deletions news/5915.documentation
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Block search engines from indexing content on Netlify preview builds. @stevepiercy
1 change: 1 addition & 0 deletions packages/volto/news/5262.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(fix): make search block sort and facets work on edit @dobri1408
24 changes: 23 additions & 1 deletion src/components/manage/Add/Add.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
} from '@plone/volto/helpers';

import { preloadLazyLibs } from '@plone/volto/helpers/Loadable';
import { tryParseJSON } from '@plone/volto/helpers';

import config from '@plone/volto/registry';

Expand Down Expand Up @@ -71,6 +72,10 @@ const messages = defineMessages({
id: 'Translate to {lang}',
defaultMessage: 'Translate to {lang}',
},
someErrors: {
id: 'There are some errors.',
defaultMessage: 'There are some errors.',
},
});

/**
Expand Down Expand Up @@ -174,13 +179,30 @@ class Add extends Component {
new DOMParser().parseFromString(message, 'text/html')?.all[0]
?.textContent || message;

const errorsList = tryParseJSON(error);
let erroMessage;
if (Array.isArray(errorsList)) {
const invariantErrors = errorsList
.filter((errorItem) => !('field' in errorItem))
.map((errorItem) => errorItem['message']);
if (invariantErrors.length > 0) {
// Plone invariant validation message.
erroMessage = invariantErrors.join(' - ');
} else {
// Error in specific field.
erroMessage = this.props.intl.formatMessage(messages.someErrors);
}
} else {
erroMessage = error;
}

this.setState({ error: error });

toast.error(
<Toast
error
title={this.props.intl.formatMessage(messages.error)}
content={`${nextProps.createRequest.error.status}: ${error}`}
content={erroMessage}
/>,
);
}
Expand Down
10 changes: 8 additions & 2 deletions src/components/manage/Blocks/Search/SearchBlockEdit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,15 @@ const SearchBlockEdit = (props) => {
const { query = {} } = data || {};
// We don't need deep compare here, as this is just json serializable data.
const deepQuery = JSON.stringify(query);

useEffect(() => {
onTriggerSearch();
}, [deepQuery, onTriggerSearch]);
onTriggerSearch(
'',
data?.facets,
data?.query?.sort_on,
data?.query?.sort_order,
);
}, [deepQuery, onTriggerSearch, data]);

return (
<>
Expand Down
4 changes: 2 additions & 2 deletions src/components/manage/Blocks/Search/hocs/withSearch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -404,12 +404,12 @@ const withSearch = (options) => (WrappedComponent) => {
query: data.query || {},
facets: toSearchFacets || facets,
searchText: toSearchText ? toSearchText.trim() : '',
sortOn: toSortOn || sortOn,
sortOn: toSortOn || undefined,
sortOrder: toSortOrder || sortOrder,
facetSettings,
});
if (toSearchFacets) setFacets(toSearchFacets);
if (toSortOn) setSortOn(toSortOn);
if (toSortOn) setSortOn(toSortOn || undefined);
if (toSortOrder) setSortOrder(toSortOrder);
setSearchData(newSearchData);
setLocationSearchData(getSearchFields(newSearchData));
Expand Down
Loading

0 comments on commit 700d367

Please sign in to comment.