@plone/volto 16.31.1 → 16.31.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.changelog.draft CHANGED
@@ -1,8 +1,7 @@
1
- ## 16.31.1 (2024-02-28)
1
+ ## 16.31.3 (2024-03-06)
2
2
 
3
3
  ### Bugfix
4
4
 
5
- - Fix the condition deciding on listing pagination format so it takes into account container blocks as well @sneridagh [#4978](https://github.com/plone/volto/issues/4978)
6
- - Enhance findBlocks to check for blocks also in data for add-ons such as @eeacms/volto-tabs-block. @ichim-david [#5796](https://github.com/plone/volto/issues/5796)
5
+ - Fix multilingual redirector where it doesn't take into account the stored cookie in SSR. @robgietema [#5628](https://github.com/plone/volto/issues/5628)
7
6
 
8
7
 
Binary file
package/CHANGELOG.md CHANGED
@@ -8,6 +8,18 @@
8
8
 
9
9
  <!-- towncrier release notes start -->
10
10
 
11
+ ## 16.31.3 (2024-03-06)
12
+
13
+ ### Bugfix
14
+
15
+ - Fix multilingual redirector where it doesn't take into account the stored cookie in SSR. @robgietema [#5628](https://github.com/plone/volto/issues/5628)
16
+
17
+ ## 16.31.2 (2024-03-05)
18
+
19
+ ### Bugfix
20
+
21
+ - Fix translation error message. @robgietema [#5835](https://github.com/plone/volto/issues/5835)
22
+
11
23
  ## 16.31.1 (2024-02-28)
12
24
 
13
25
  ### Bugfix
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "16.31.1",
12
+ "version": "16.31.3",
13
13
  "repository": {
14
14
  "type": "git",
15
15
  "url": "git@github.com:plone/volto.git"
@@ -368,7 +368,7 @@
368
368
  "react-simple-code-editor": "0.7.1",
369
369
  "react-sortable-hoc": "2.0.0",
370
370
  "react-test-renderer": "17.0.2",
371
- "react-toastify": "5.4.1",
371
+ "react-toastify": "5.5.0",
372
372
  "react-transition-group": "4.4.5",
373
373
  "react-virtualized": "9.22.3",
374
374
  "redraft": "0.10.2",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plone/volto-slate",
3
- "version": "16.31.1",
3
+ "version": "16.31.3",
4
4
  "description": "Slate.js integration with Volto",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -37,6 +37,7 @@ import {
37
37
  } from '@plone/volto/helpers';
38
38
 
39
39
  import { preloadLazyLibs } from '@plone/volto/helpers/Loadable';
40
+ import { tryParseJSON } from '@plone/volto/helpers';
40
41
 
41
42
  import config from '@plone/volto/registry';
42
43
 
@@ -178,13 +179,29 @@ class Add extends Component {
178
179
  new DOMParser().parseFromString(message, 'text/html')?.all[0]
179
180
  ?.textContent || message;
180
181
 
181
- this.setState({ error: error });
182
+ const errorsList = tryParseJSON(error);
183
+ let erroMessage;
184
+ if (Array.isArray(errorsList)) {
185
+ const invariantErrors = errorsList
186
+ .filter((errorItem) => !('field' in errorItem))
187
+ .map((errorItem) => errorItem['message']);
188
+ if (invariantErrors.length > 0) {
189
+ // Plone invariant validation message.
190
+ erroMessage = invariantErrors.join(' - ');
191
+ } else {
192
+ // Error in specific field.
193
+ erroMessage = this.props.intl.formatMessage(messages.someErrors);
194
+ }
195
+ } else {
196
+ erroMessage = errorsList.error?.message || error;
197
+ }
182
198
 
199
+ this.setState({ error: error });
183
200
  toast.error(
184
201
  <Toast
185
202
  error
186
203
  title={this.props.intl.formatMessage(messages.error)}
187
- content={`${nextProps.createRequest.error.status}: ${error}`}
204
+ content={erroMessage}
188
205
  />,
189
206
  );
190
207
  }
@@ -156,7 +156,7 @@ const widgetValidation = {
156
156
  * The string that comes my not be a valid JSON
157
157
  * @param {string} requestItem
158
158
  */
159
- const tryParseJSON = (requestItem) => {
159
+ export const tryParseJSON = (requestItem) => {
160
160
  let resultObj = null;
161
161
  try {
162
162
  resultObj = JSON.parse(requestItem);
@@ -75,6 +75,7 @@ export { default as langmap } from './LanguageMap/LanguageMap';
75
75
  export { default as Helmet } from './Helmet/Helmet';
76
76
  export { default as FormValidation } from './FormValidation/FormValidation';
77
77
  export { validateFileUploadSize } from './FormValidation/FormValidation';
78
+ export { tryParseJSON } from './FormValidation/FormValidation';
78
79
  export {
79
80
  difference,
80
81
  getColor,
package/src/server.jsx CHANGED
@@ -239,7 +239,7 @@ server.get('/*', (req, res) => {
239
239
  : store.getState().content.data?.language?.token ||
240
240
  config.settings.defaultLanguage;
241
241
 
242
- if (toBackendLang(initialLang) !== contentLang) {
242
+ if (toBackendLang(initialLang) !== contentLang && url !== '/') {
243
243
  const newLang = toReactIntlLang(
244
244
  new locale.Locales(contentLang).best(supported).toString(),
245
245
  );