Skip to content

Commit

Permalink
Merge branch 'master' into improveslugs
Browse files Browse the repository at this point in the history
* master:
  fix preview image (#5153)
  fixed deprecated buffer.from (#5205)
  feat: add canonical link (#5215)
  Fix links to link integrity in delete modal (#5226)
  (fixes #5124) Enhance Accessibility, Add aria-label to search.  (#5224)
  document the querystringSearchGet setting (#5206)
  Fix empty slate text block in table of contents (#5156)
  • Loading branch information
sneridagh committed Sep 26, 2023
2 parents a866235 + f1610c5 commit 9c8740e
Show file tree
Hide file tree
Showing 32 changed files with 126 additions and 26 deletions.
2 changes: 1 addition & 1 deletion create-addons-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ module.exports = (addons, addonsInfo) => {

const addonsLoaderPath = tmp.tmpNameSync({ postfix: '.js' });
const code = getAddonsLoaderCode(addons, addonsInfo);
fs.writeFileSync(addonsLoaderPath, new Buffer.from(code));
fs.writeFileSync(addonsLoaderPath, Buffer.from(code));
return addonsLoaderPath;
};

Expand Down
11 changes: 11 additions & 0 deletions docs/source/configuration/settings-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,17 @@ siteTitleFormat
}
```
querystringSearchGet
Volto uses `HTTP POST` requests to query the `@querystring-search` endpoint.
This can create a lot of traffic between Volto and the backend, and can also create a lot of cache misses.
By modifying this configuration setting and setting it to `true`, the endpoint queries will be executed as `HTTP GET` requests.
Thus any proxy cache in between Volto and the backend may cache those queries, improving your site performance.
Please be aware that this could break some other functionality in your site, or some of your queries may break, when they contain more than 2000 characters.
[See an explanation of character limits in URLs](https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers/417184#417184).
Please test this setting properly before enabling in a production site.
```

## Views settings
Expand Down
1 change: 1 addition & 0 deletions locales/ca/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -2996,6 +2996,7 @@ msgstr "Actualitzacions d'esquemes"
#: components/manage/Blocks/Search/layout/RightColumnFacets
#: components/manage/Blocks/Search/layout/TopSideFacets
#: components/manage/Blocks/Search/schema
#: components/manage/Sharing/Sharing
#: components/theme/Search/Search
#: components/theme/SearchWidget/SearchWidget
# defaultMessage: Search
Expand Down
1 change: 1 addition & 0 deletions locales/de/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -2993,6 +2993,7 @@ msgstr "Aktualisierungen Schema"
#: components/manage/Blocks/Search/layout/RightColumnFacets
#: components/manage/Blocks/Search/layout/TopSideFacets
#: components/manage/Blocks/Search/schema
#: components/manage/Sharing/Sharing
#: components/theme/Search/Search
#: components/theme/SearchWidget/SearchWidget
# defaultMessage: Search
Expand Down
1 change: 1 addition & 0 deletions locales/en/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -2987,6 +2987,7 @@ msgstr ""
#: components/manage/Blocks/Search/layout/RightColumnFacets
#: components/manage/Blocks/Search/layout/TopSideFacets
#: components/manage/Blocks/Search/schema
#: components/manage/Sharing/Sharing
#: components/theme/Search/Search
#: components/theme/SearchWidget/SearchWidget
# defaultMessage: Search
Expand Down
1 change: 1 addition & 0 deletions locales/es/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -2998,6 +2998,7 @@ msgstr "Actualización de esquema"
#: components/manage/Blocks/Search/layout/RightColumnFacets
#: components/manage/Blocks/Search/layout/TopSideFacets
#: components/manage/Blocks/Search/schema
#: components/manage/Sharing/Sharing
#: components/theme/Search/Search
#: components/theme/SearchWidget/SearchWidget
# defaultMessage: Search
Expand Down
1 change: 1 addition & 0 deletions locales/eu/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -2994,6 +2994,7 @@ msgstr "Eskemaren eguneraketak"
#: components/manage/Blocks/Search/layout/RightColumnFacets
#: components/manage/Blocks/Search/layout/TopSideFacets
#: components/manage/Blocks/Search/schema
#: components/manage/Sharing/Sharing
#: components/theme/Search/Search
#: components/theme/SearchWidget/SearchWidget
# defaultMessage: Search
Expand Down
1 change: 1 addition & 0 deletions locales/fi/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -2998,6 +2998,7 @@ msgstr "Skeemapäivitykset"
#: components/manage/Blocks/Search/layout/RightColumnFacets
#: components/manage/Blocks/Search/layout/TopSideFacets
#: components/manage/Blocks/Search/schema
#: components/manage/Sharing/Sharing
#: components/theme/Search/Search
#: components/theme/SearchWidget/SearchWidget
# defaultMessage: Search
Expand Down
1 change: 1 addition & 0 deletions locales/fr/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -3004,6 +3004,7 @@ msgstr "Mises à jour du schéma"
#: components/manage/Blocks/Search/layout/RightColumnFacets
#: components/manage/Blocks/Search/layout/TopSideFacets
#: components/manage/Blocks/Search/schema
#: components/manage/Sharing/Sharing
#: components/theme/Search/Search
#: components/theme/SearchWidget/SearchWidget
# defaultMessage: Search
Expand Down
1 change: 1 addition & 0 deletions locales/it/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -2987,6 +2987,7 @@ msgstr "Aggiornamenti dello schema"
#: components/manage/Blocks/Search/layout/RightColumnFacets
#: components/manage/Blocks/Search/layout/TopSideFacets
#: components/manage/Blocks/Search/schema
#: components/manage/Sharing/Sharing
#: components/theme/Search/Search
#: components/theme/SearchWidget/SearchWidget
# defaultMessage: Search
Expand Down
1 change: 1 addition & 0 deletions locales/ja/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -2995,6 +2995,7 @@ msgstr "スキーマの更新"
#: components/manage/Blocks/Search/layout/RightColumnFacets
#: components/manage/Blocks/Search/layout/TopSideFacets
#: components/manage/Blocks/Search/schema
#: components/manage/Sharing/Sharing
#: components/theme/Search/Search
#: components/theme/SearchWidget/SearchWidget
# defaultMessage: Search
Expand Down
1 change: 1 addition & 0 deletions locales/nl/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -3006,6 +3006,7 @@ msgstr ""
#: components/manage/Blocks/Search/layout/RightColumnFacets
#: components/manage/Blocks/Search/layout/TopSideFacets
#: components/manage/Blocks/Search/schema
#: components/manage/Sharing/Sharing
#: components/theme/Search/Search
#: components/theme/SearchWidget/SearchWidget
# defaultMessage: Search
Expand Down
1 change: 1 addition & 0 deletions locales/pt/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -2995,6 +2995,7 @@ msgstr ""
#: components/manage/Blocks/Search/layout/RightColumnFacets
#: components/manage/Blocks/Search/layout/TopSideFacets
#: components/manage/Blocks/Search/schema
#: components/manage/Sharing/Sharing
#: components/theme/Search/Search
#: components/theme/SearchWidget/SearchWidget
# defaultMessage: Search
Expand Down
1 change: 1 addition & 0 deletions locales/pt_BR/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -2997,6 +2997,7 @@ msgstr "Atualizações do esquema"
#: components/manage/Blocks/Search/layout/RightColumnFacets
#: components/manage/Blocks/Search/layout/TopSideFacets
#: components/manage/Blocks/Search/schema
#: components/manage/Sharing/Sharing
#: components/theme/Search/Search
#: components/theme/SearchWidget/SearchWidget
# defaultMessage: Search
Expand Down
1 change: 1 addition & 0 deletions locales/ro/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -2987,6 +2987,7 @@ msgstr "Actualizări de schemă"
#: components/manage/Blocks/Search/layout/RightColumnFacets
#: components/manage/Blocks/Search/layout/TopSideFacets
#: components/manage/Blocks/Search/schema
#: components/manage/Sharing/Sharing
#: components/theme/Search/Search
#: components/theme/SearchWidget/SearchWidget
# defaultMessage: Search
Expand Down
5 changes: 3 additions & 2 deletions locales/volto.pot
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ msgid "Action changed"
msgstr ""

#: components/manage/Controlpanels/Rules/ConfigureRule
# defaultMessage: Action:
# defaultMessage: Action:
msgid "Action: "
msgstr ""

Expand Down Expand Up @@ -683,7 +683,7 @@ msgid "Condition changed"
msgstr ""

#: components/manage/Controlpanels/Rules/ConfigureRule
# defaultMessage: Condition:
# defaultMessage: Condition:
msgid "Condition: "
msgstr ""

Expand Down Expand Up @@ -2989,6 +2989,7 @@ msgstr ""
#: components/manage/Blocks/Search/layout/RightColumnFacets
#: components/manage/Blocks/Search/layout/TopSideFacets
#: components/manage/Blocks/Search/schema
#: components/manage/Sharing/Sharing
#: components/theme/Search/Search
#: components/theme/SearchWidget/SearchWidget
# defaultMessage: Search
Expand Down
1 change: 1 addition & 0 deletions locales/zh_CN/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -2993,6 +2993,7 @@ msgstr "模式更新"
#: components/manage/Blocks/Search/layout/RightColumnFacets
#: components/manage/Blocks/Search/layout/TopSideFacets
#: components/manage/Blocks/Search/schema
#: components/manage/Sharing/Sharing
#: components/theme/Search/Search
#: components/theme/SearchWidget/SearchWidget
# defaultMessage: Search
Expand Down
1 change: 1 addition & 0 deletions news/5124.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improved accessibility by adding an `aria-label` to the search icon on sharing page. @ZubairImtiaz3
1 change: 1 addition & 0 deletions news/5153.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed PreviewImage component to work as Image component when testing image, and added showDefault prop to PreviewImage
1 change: 1 addition & 0 deletions news/5156.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix empty slate text block in table of contents. @kreafox
1 change: 1 addition & 0 deletions news/5205.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated the deprecated Buffer.from package in create-addons-loader.js @Junko-Takeguchi
1 change: 1 addition & 0 deletions news/5206.documentation
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Document the `querystringSearchGet` setting @erral
1 change: 1 addition & 0 deletions news/5215.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add canonical link @mamico
1 change: 1 addition & 0 deletions news/5226.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix links to link integrity in delete modal @sneridagh
1 change: 1 addition & 0 deletions src/components/manage/Blocks/ToC/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ const View = (props) => {
const level = entry[0];
const title = entry[1];
const items = [];
if (!title?.trim() && !block.plaintext?.trim()) return;
if (!level || !levels.includes(level)) return;
tocEntriesLayout.push(id);
tocEntries[id] = {
Expand Down
17 changes: 13 additions & 4 deletions src/components/manage/Contents/Contents.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
import move from 'lodash-move';
import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
import { asyncConnect } from '@plone/volto/helpers';
import { flattenToAppURL } from '@plone/volto/helpers';

import {
searchContent,
Expand Down Expand Up @@ -1361,12 +1362,16 @@ class Contents extends Component {
}}
/>
<div className="broken-links-list-link-wrapper">
<a href={this.state.brokenLinksList}>
<Link
to={flattenToAppURL(
this.state.brokenLinksList,
)}
>
<FormattedMessage
id="View broken links list"
defaultMessage="View broken links list"
/>
</a>
</Link>
</div>
</>
)}
Expand Down Expand Up @@ -1398,12 +1403,16 @@ class Contents extends Component {
}}
/>
<div className="broken-links-list-link-wrapper">
<a href={this.state.brokenLinksList}>
<Link
to={flattenToAppURL(
this.state.brokenLinksList,
)}
>
<FormattedMessage
id="View broken links list"
defaultMessage="View broken links list"
/>
</a>
</Link>
</div>
</>
) : null}
Expand Down
7 changes: 7 additions & 0 deletions src/components/manage/Sharing/Sharing.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ const messages = defineMessages({
id: 'Search for user or group',
defaultMessage: 'Search for user or group',
},
search: {
id: 'Search',
defaultMessage: 'Search',
},
inherit: {
id: 'Inherit permissions from higher levels',
defaultMessage: 'Inherit permissions from higher levels',
Expand Down Expand Up @@ -343,6 +347,9 @@ class SharingComponent extends Component {
icon: 'search',
loading: isLoading,
disabled: isLoading,
'aria-label': this.props.intl.formatMessage(
messages.search,
),
}}
placeholder={this.props.intl.formatMessage(
messages.searchForUserOrGroup,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ exports[`Sharing renders a sharing component 1`] = `
type="text"
/>
<button
aria-label="Search"
className="ui icon button"
onClick={[Function]}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ const ContentMetadataTags = (props) => {
<>
<Helmet>
<title>{getTitle()?.replace(/\u00AD/g, '')}</title>
<link
rel="canonical"
href={seo_canonical_url || toPublicURL(props.content['@id'])}
/>
<meta name="description" content={seo_description || description} />
<meta
property="og:title"
Expand Down
15 changes: 10 additions & 5 deletions src/components/theme/PreviewImage/PreviewImage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ import DefaultImageSVG from '@plone/volto/components/manage/Blocks/Listing/defau
/**
* Renders a preview image for a catalog brain result item.
*/
function PreviewImage({ item, alt, ...rest }) {
function PreviewImage({ item, alt, image_field, showDefault = true, ...rest }) {
const Image = config.getComponent({ name: 'Image' }).component;

if (item.image_field && item.image_scales?.[item.image_field]?.[0]) {
return (
<Image item={item} imageField={item.image_field} alt={alt} {...rest} />
);
const image = (
<Image item={item} image_field={image_field} alt={alt} {...rest} />
);

if (!image && !showDefault) return null;

if (image) {
return image;
} else {
return (
<img
Expand All @@ -38,6 +42,7 @@ PreviewImage.propTypes = {
title: PropTypes.string.isRequired,
image_field: PropTypes.string,
image_scales: PropTypes.object,
showDefault: PropTypes.bool,
}),
alt: PropTypes.string.isRequired,
};
Expand Down
17 changes: 17 additions & 0 deletions src/components/theme/PreviewImage/PreviewImage.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,21 @@ describe('PreviewImage', () => {
const json = component.toJSON();
expect(json).toMatchSnapshot();
});

it('not renders a fallback image if showDefault prop is false', () => {
const item = {
title: 'Item title',
'@id': 'http://localhost:3000/something',
};
const component = renderer.create(
<PreviewImage
item={item}
className="extra"
showDefault={false}
alt={item.title}
/>,
);
const json = component.toJSON();
expect(json).toMatchSnapshot();
});
});
Loading

0 comments on commit 9c8740e

Please sign in to comment.