@eeacms/volto-eea-website-policy 4.0.4 → 4.0.6
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.md +17 -1
- package/jest-addon.config.js +0 -2
- package/package.json +3 -5
- package/src/components/AuthenticatedManageTranslations/AuthenticatedManageTranslations.jsx +18 -0
- package/src/components/AuthenticatedManageTranslations/AuthenticatedManageTranslations.test.jsx +78 -0
- package/src/index.js +10 -0
- package/src/routes.js +11 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
### [4.0.6](https://github.com/eea/volto-eea-website-policy/compare/4.0.5...4.0.6) - 2 October 2026
|
|
8
|
+
|
|
9
|
+
#### :bug: Bug Fixes
|
|
10
|
+
|
|
11
|
+
- fix: Cleanup obsolete depedency on volto-authomatic [Alin Voinea - [`2f29b02`](https://github.com/eea/volto-eea-website-policy/commit/2f29b02cc66728d9777d1b61a83390a5a2f510e7)]
|
|
12
|
+
|
|
13
|
+
#### :hammer_and_wrench: Others
|
|
14
|
+
|
|
15
|
+
- pin volto-authomatic since jenkins fails [Teodor Voicu - [`35d8de4`](https://github.com/eea/volto-eea-website-policy/commit/35d8de4b9978d8bf84061c7308838a1e10e2cceb)]
|
|
16
|
+
### [4.0.5](https://github.com/eea/volto-eea-website-policy/compare/4.0.4...4.0.5) - 15 September 2026
|
|
17
|
+
|
|
18
|
+
#### :bug: Bug Fixes
|
|
19
|
+
|
|
20
|
+
- fix: manage translations page visibility permissions - refs #307442 [dobri1408 - [`6f4991c`](https://github.com/eea/volto-eea-website-policy/commit/6f4991c30aa01c52f786d22992a111144f2650e1)]
|
|
21
|
+
|
|
22
|
+
#### :hammer_and_wrench: Others
|
|
23
|
+
|
|
7
24
|
### [4.0.4](https://github.com/eea/volto-eea-website-policy/compare/4.0.3...4.0.4) - 20 August 2026
|
|
8
25
|
|
|
9
26
|
#### :bug: Bug Fixes
|
|
@@ -15,7 +32,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
15
32
|
|
|
16
33
|
#### :hammer_and_wrench: Others
|
|
17
34
|
|
|
18
|
-
- Release 4.0.4 [Alin Voinea - [`0c2f4d3`](https://github.com/eea/volto-eea-website-policy/commit/0c2f4d3314a8b78057debb646bf25e4a372ed1ab)]
|
|
19
35
|
- Remove publication type configuration [dobri1408 - [`318a0df`](https://github.com/eea/volto-eea-website-policy/commit/318a0dfe04b313b8cbc17e91ec2cf87e4c8850b0)]
|
|
20
36
|
- Remove @eeacms/volto-globalsearch from package.json [dobri1408 - [`0e0f88a`](https://github.com/eea/volto-eea-website-policy/commit/0e0f88a7083b7de338d900ed4de00725fec4ac99)]
|
|
21
37
|
- Remove publication type settings from index.js [dobri1408 - [`bc2c6a0`](https://github.com/eea/volto-eea-website-policy/commit/bc2c6a022691b799c9b8cd81a2d55426ce706182)]
|
package/jest-addon.config.js
CHANGED
|
@@ -27,8 +27,6 @@ module.exports = {
|
|
|
27
27
|
],
|
|
28
28
|
moduleNameMapper: {
|
|
29
29
|
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
|
|
30
|
-
'@plone-collective/volto-authomatic/(.*)$':
|
|
31
|
-
'<rootDir>/node_modules/@plone-collective/volto-authomatic/src/$1',
|
|
32
30
|
'@plone/volto/cypress': '<rootDir>/node_modules/@plone/volto/cypress',
|
|
33
31
|
'@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
|
|
34
32
|
'@plone/volto/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eeacms/volto-eea-website-policy",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.6",
|
|
4
4
|
"description": "@eeacms/volto-eea-website-policy: Volto add-on",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "European Environment Agency: IDM2 A-Team",
|
|
@@ -18,13 +18,11 @@
|
|
|
18
18
|
},
|
|
19
19
|
"addons": [
|
|
20
20
|
"@eeacms/volto-widget-dataprovenance",
|
|
21
|
-
"@eeacms/volto-globalsearch"
|
|
22
|
-
"@plone-collective/volto-authomatic"
|
|
21
|
+
"@eeacms/volto-globalsearch"
|
|
23
22
|
],
|
|
24
23
|
"dependencies": {
|
|
25
24
|
"@eeacms/volto-globalsearch": "*",
|
|
26
|
-
"@eeacms/volto-widget-dataprovenance": "*"
|
|
27
|
-
"@plone-collective/volto-authomatic": "*"
|
|
25
|
+
"@eeacms/volto-widget-dataprovenance": "*"
|
|
28
26
|
},
|
|
29
27
|
"devDependencies": {
|
|
30
28
|
"@cypress/code-coverage": "^3.10.0",
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useSelector } from 'react-redux';
|
|
3
|
+
import { Redirect, useLocation } from 'react-router-dom';
|
|
4
|
+
import ManageTranslations from '@plone/volto/components/manage/Multilingual/ManageTranslations';
|
|
5
|
+
|
|
6
|
+
const AuthenticatedManageTranslations = (props) => {
|
|
7
|
+
const token = useSelector((state) => state.userSession.token);
|
|
8
|
+
const { pathname, search, hash } = useLocation();
|
|
9
|
+
|
|
10
|
+
if (!token) {
|
|
11
|
+
const returnUrl = encodeURIComponent(pathname + search + hash);
|
|
12
|
+
return <Redirect to={`/login?return_url=${returnUrl}`} />;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return <ManageTranslations {...props} />;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default AuthenticatedManageTranslations;
|
package/src/components/AuthenticatedManageTranslations/AuthenticatedManageTranslations.test.jsx
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { renderToString } from 'react-dom/server';
|
|
3
|
+
import { Provider } from 'react-redux';
|
|
4
|
+
import { Router, StaticRouter } from 'react-router-dom';
|
|
5
|
+
import { matchRoutes, renderRoutes } from 'react-router-config';
|
|
6
|
+
import { createMemoryHistory } from 'history';
|
|
7
|
+
import { render } from '@testing-library/react';
|
|
8
|
+
import configureStore from 'redux-mock-store';
|
|
9
|
+
import ManageTranslations from '@plone/volto/components/manage/Multilingual/ManageTranslations';
|
|
10
|
+
import AuthenticatedManageTranslations from './AuthenticatedManageTranslations';
|
|
11
|
+
import routes from '../../routes';
|
|
12
|
+
|
|
13
|
+
jest.mock(
|
|
14
|
+
'@plone/volto/components/manage/Multilingual/ManageTranslations',
|
|
15
|
+
() => {
|
|
16
|
+
return jest.fn(() => <div>Translation management</div>);
|
|
17
|
+
},
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
const mockStore = configureStore();
|
|
21
|
+
const url = '/en/about/manage-translations?language=ro#translations';
|
|
22
|
+
const loginUrl = `/login?return_url=${encodeURIComponent(url)}`;
|
|
23
|
+
|
|
24
|
+
beforeEach(() => {
|
|
25
|
+
jest.clearAllMocks();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('redirects anonymous server requests without rendering translation management', () => {
|
|
29
|
+
const context = {};
|
|
30
|
+
const html = renderToString(
|
|
31
|
+
<Provider store={mockStore({ userSession: { token: null } })}>
|
|
32
|
+
<StaticRouter location={url} context={context}>
|
|
33
|
+
{renderRoutes(routes)}
|
|
34
|
+
</StaticRouter>
|
|
35
|
+
</Provider>,
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
expect(context.url).toBe(loginUrl);
|
|
39
|
+
expect(html).toBe('');
|
|
40
|
+
expect(ManageTranslations).not.toHaveBeenCalled();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('redirects anonymous client navigation to login with the return URL', () => {
|
|
44
|
+
const history = createMemoryHistory({ initialEntries: [url] });
|
|
45
|
+
render(
|
|
46
|
+
<Provider store={mockStore({ userSession: { token: null } })}>
|
|
47
|
+
<Router history={history}>{renderRoutes(routes)}</Router>
|
|
48
|
+
</Provider>,
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
expect(history.location.pathname + history.location.search).toBe(loginUrl);
|
|
52
|
+
expect(ManageTranslations).not.toHaveBeenCalled();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('leaves nested login and create-translation routes to Volto', () => {
|
|
56
|
+
expect(matchRoutes(routes, '/en/about/manage-translations/login')).toEqual(
|
|
57
|
+
[],
|
|
58
|
+
);
|
|
59
|
+
expect(
|
|
60
|
+
matchRoutes(routes, '/en/about/manage-translations/create-translation'),
|
|
61
|
+
).toEqual([]);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('renders translation management for authenticated users and forwards route props', () => {
|
|
65
|
+
const context = {};
|
|
66
|
+
const routeProps = { match: { url: '/en/about/manage-translations' } };
|
|
67
|
+
const html = renderToString(
|
|
68
|
+
<Provider store={mockStore({ userSession: { token: 'session-token' } })}>
|
|
69
|
+
<StaticRouter location={url} context={context}>
|
|
70
|
+
<AuthenticatedManageTranslations {...routeProps} />
|
|
71
|
+
</StaticRouter>
|
|
72
|
+
</Provider>,
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
expect(context.url).toBeUndefined();
|
|
76
|
+
expect(html).toContain('Translation management');
|
|
77
|
+
expect(ManageTranslations.mock.calls[0][0]).toEqual(routeProps);
|
|
78
|
+
});
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { appendGroup, getAsyncData } from './helpers';
|
|
2
2
|
import { FrequencyOfDissemination } from '@eeacms/volto-eea-website-policy/components/Widgets/FrequencyOfDissemination';
|
|
3
3
|
import ErrorView from '@eeacms/volto-eea-website-policy/components/ErrorView/ErrorView';
|
|
4
|
+
import routes from './routes';
|
|
4
5
|
|
|
5
6
|
const restrictedBlocks = [
|
|
6
7
|
'imagecards',
|
|
@@ -37,6 +38,8 @@ const overrideBlocks = {
|
|
|
37
38
|
};
|
|
38
39
|
|
|
39
40
|
const applyConfig = (config) => {
|
|
41
|
+
config.addonRoutes = [...routes, ...(config.addonRoutes || [])];
|
|
42
|
+
|
|
40
43
|
// #160689 Redirect contact-form to contact-us
|
|
41
44
|
config.settings.contactForm = '/en/about/contact-us';
|
|
42
45
|
|
|
@@ -97,6 +100,13 @@ const applyConfig = (config) => {
|
|
|
97
100
|
rolesWhoCanChangeLayout: ['Manager'],
|
|
98
101
|
};
|
|
99
102
|
|
|
103
|
+
// EPANET subsite: hardcoded governance exception, intentionally not
|
|
104
|
+
// editable from the CMS. The uploaded subsite logo replaces the EEA logo
|
|
105
|
+
// and the footer only shows the bottom links (Privacy -> subsite privacy).
|
|
106
|
+
const EPANET_SUBSITE = /^\/[a-z]{2}\/epanet$/;
|
|
107
|
+
config.settings.eea.subsiteMainLogoPaths = [EPANET_SUBSITE];
|
|
108
|
+
config.settings.eea.subsiteHideFooterPaths = [EPANET_SUBSITE];
|
|
109
|
+
|
|
100
110
|
// mega menu layout settings
|
|
101
111
|
config.settings.menuItemsLayouts = {
|
|
102
112
|
'/en/topics': {
|
package/src/routes.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import AuthenticatedManageTranslations from './components/AuthenticatedManageTranslations/AuthenticatedManageTranslations';
|
|
2
|
+
|
|
3
|
+
const routes = [
|
|
4
|
+
{
|
|
5
|
+
path: '/**/manage-translations',
|
|
6
|
+
exact: true,
|
|
7
|
+
component: AuthenticatedManageTranslations,
|
|
8
|
+
},
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
export default routes;
|