Skip to content

Commit

Permalink
Merge branch 'master' into userManagementRedesign
Browse files Browse the repository at this point in the history
  • Loading branch information
rahilhastu committed Aug 28, 2023
2 parents cee345d + 63fbe91 commit d2c0124
Show file tree
Hide file tree
Showing 40 changed files with 847 additions and 582 deletions.
43 changes: 42 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,49 @@
<!-- You should *NOT* be adding new change log entries to this file.
You should create a file in the news directory instead.
For helpful instructions, please see:
https://6.docs.plone.org/volto/developer-guidelines/contributing.html#create-a-pull-request
https://6.docs.plone.org/contributing/index.html#contributing-change-log-label
-->

<!-- towncrier release notes start -->

## 17.0.0-alpha.25 (2023-08-25)

### Breaking

- Spin off relation stats action. Get relation stats with getRelationStats() instead of with queryRelations(). @ksuess
Refactor relations actions: slightly change the shape of the redux state for `queryRelations` to follow common signatures. @ksuess [#5041](https://github.com/plone/volto/issues/5041)

### Feature

- Refactor Comment -@Tishasoumya-02 [#4074](https://github.com/plone/volto/issues/4074)
- Refactor Logout component @Tishasoumya-02 [#4860](https://github.com/plone/volto/issues/4860)
- Refactore SearchTags @Tishasoumya-02 [#4873](https://github.com/plone/volto/issues/4873)

### Bugfix

- Allow a user to register when they use an email address as their username. [#5031](https://github.com/plone/volto/issues/5031) @mehedikhan72 [#5031](https://github.com/plone/volto/issues/5031)
- Fix querystringResults subrequests id, to work properly in duplicate pages where blocks id's are the same. @giuliaghisini [#5070](https://github.com/plone/volto/issues/5070)
- Fix i18n for link settings fieldset in the image block @iRohitSingh [#5075](https://github.com/plone/volto/issues/5075)
- Prevent caching the outdated browser message in a shared cache. @davisagli [#5076](https://github.com/plone/volto/issues/5076)
- Fix accessibility of the content folder buttons. @SaraBianchi [#5101](https://github.com/plone/volto/issues/5101)
- For folders inside navigation roots, properly fetch navigation from the
navroot, rather then the site root @tiberiuichim [#5106](https://github.com/plone/volto/issues/5106)
- Fix uncached case when the widget is slate on diff @dobri1408 [#5107](https://github.com/plone/volto/issues/5107)
- Fix load addon translations: last addon translations wins @giuliaghisini [#5113](https://github.com/plone/volto/issues/5113)
- [Visual bugfix] Match the original mockups for PastanagaUI in regards of the error messages in form field elements @sneridagh [#5115](https://github.com/plone/volto/issues/5115)
- Fix default toc renderer for nested entries @pnicolli [#5116](https://github.com/plone/volto/issues/5116)
- Fix inherit checkbox in sharing view @sneridagh [#5514](https://github.com/plone/volto/issues/5514)

### Internal

- Improved spellcheck to keep spellings consistent. @chirayu-humar [#1190](https://github.com/plone/volto/issues/1190)

### Documentation

- Update links to contributing. @stevepiercy [#5084](https://github.com/plone/volto/issues/5084)
- Accept `plone` and `volto` in labels with janky regex. Include Vale styles directory for checking spelling and styles. @stevepiercy [#5095](https://github.com/plone/volto/issues/5095)


## 17.0.0-alpha.24 (2023-08-09)

### Breaking
Expand All @@ -23,6 +61,9 @@

- Fix 302 redirect in changelog. @stevepiercy [#5068](https://github.com/plone/volto/issues/5068)

### Internal

- Add https://www.dlr.de/de to "Volto in production" list. @tisto [#5112](https://github.com/plone/volto/pull/5112)

## 17.0.0-alpha.23 (2023-07-28)

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ Volto is actively developed since 2017 and used in production since 2018 on the
- [Helmholtz-Institut Erlangen-Nürnberg für Erneuerbare Energien (HI-ERN)](https://www.hi-ern.de) (Website for HI ERN, a research institution for renewable energies, developed by [kitconcept GmbH](https://kitconcept.com), 2022)
- [Lanku](https://www.lanku.eus) (Website for Lanku Kultur Zerbitzuak, a company offering cultural services and improvised Basque verse singing sessions across the Basque Country, developed by [CodeSyntax](https://www.codesyntax.com/en), 2023)
- [UEU](https://www.ueu.eus) (Website for Udako Euskal Unibertsitatea, a non-profit University offering all its service only in Basque: courses, publications, ... developed by [CodeSyntax](https://www.codesyntax.com/en), 2023)
- [German Aerospace Center (DLR)](https://www.dlr.de/de) (The German Aerospace Center (DLR) is the Federal Republic of Germany's research center for aeronautics. With more than 10.000 employees and a yearly budget of more than 1 billion euros, it is one of the largest research institutions in Germany, developed by [kitconcept GmbH](https://kitconcept.com), 2023)

Please create a new [issue](https://github.com/plone/volto/issues/new) or [pull request](https://github.com/plone/volto/pulls) to add your Volto-site here!

Expand Down
20 changes: 20 additions & 0 deletions cypress/tests/core/basic/logout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { ploneAuth } from '../../../support/constants';

describe('Logout Tests', () => {
beforeEach(() => {
cy.visit('/');
cy.contains('Log in').click();
const user = ploneAuth[0];
const password = ploneAuth[1];

cy.get('#login').type(user).should('have.value', user);
cy.get('#password').type(password).should('have.value', password);
cy.get('#login-form-submit').click();
cy.get('body').should('have.class', 'has-toolbar');
});
it('As registered user I can logout', function () {
cy.get('#toolbar-personal').click();
cy.get('#toolbar-logout').click();
cy.getCookie('auth_key').should('not.exist');
});
});
23 changes: 23 additions & 0 deletions cypress/tests/core/basic/sharing.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,27 @@ describe('Sharing Tests', () => {
cy.visit('/my-page');
cy.findByRole('heading', { name: /my page/i }).should('exist');
});

it('As editor, I can uncheck the inherit permissions checkbox', function () {
cy.intercept('/**/@logout').as('logout');
cy.intercept('/**/@sharing').as('sharing');

// Click on the Toolbar > More
cy.findByRole('button', { name: /more/i }).click();
cy.findByRole('link', { name: /sharing/i }).click();
cy.wait('@sharing');

cy.findByLabelText('Inherit permissions from higher levels').click({
force: true,
});

cy.findByRole('button', { name: /save/i }).click();
cy.wait('@sharing');

cy.visit('/my-page/sharing');

cy.findByLabelText('Inherit permissions from higher levels').should(
'not.be.checked',
);
});
});
5 changes: 4 additions & 1 deletion docs/source/addons/i18n.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@ In the context of your project, run `yarn i18n` to merge the add-on translations

## Override translations

The workflow allows you to override translations from your project scope, so the project translations "always win".
If you have multiple add-ons installed in your project, the translations are loaded in the order your add-ons are listed in `package.json`.
If two add-ons provide different translations for the same message, then the last defined add-on wins.

When running `yarn i18n` in the context of your project, the project's own locales are processed last and can override translations from any add-on.
1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
r"https://github.com/plone/plone.rest#cors",
r"https://github.com/plone/plone.volto/blob/6f5382c74f668935527e962490b81cb72bf3bc94/src/kitconcept/volto/upgrades.py#L6-L54",
r"https://github.com/plone/volto/issues/new/choose",
r"https://github.com/plone/volto/blob/6fd62cb2860bc7cf3cb7c36ea86bfd8bd03247d9/src/components/manage/Form/Field.jsx#L112",
r"https://github.com/tc39/proposals/blob/HEAD/finished-proposals.md#finished-proposals",
]
linkcheck_anchors = True
Expand Down
1 change: 0 additions & 1 deletion news/1190.internal

This file was deleted.

1 change: 0 additions & 1 deletion news/5031.bugfix

This file was deleted.

2 changes: 0 additions & 2 deletions news/5041.breaking

This file was deleted.

1 change: 0 additions & 1 deletion news/5075.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion news/5076.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion news/5084.documentation

This file was deleted.

1 change: 0 additions & 1 deletion news/5095.documentation

This file was deleted.

1 change: 1 addition & 0 deletions news/5131.documentation
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix linkcheckbroken 301 redirect to https://www.dlr.de/de @stevepiercy
1 change: 1 addition & 0 deletions news/5132.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix storybook config for project generator. Add support for SCSS, upgrade to webpack 5 in there as well. @sneridagh
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
],
"license": "MIT",
"version": "17.0.0-alpha.24",
"version": "17.0.0-alpha.25",
"repository": {
"type": "git",
"url": "git@github.com:plone/volto.git"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const fileLoaderFinder = makeLoaderFinder('file-loader');

const projectRootPath = path.resolve('.');
const lessPlugin = require('@plone/volto/webpack-plugins/webpack-less-plugin');
const scssPlugin = require('razzle-plugin-scss');

const createConfig = require('../node_modules/razzle/config/createConfigAsync.js');
const razzleConfig = require(path.join(projectRootPath, 'razzle.config.js'));
Expand All @@ -20,10 +21,17 @@ const SVGLOADER = {
loader: 'svgo-loader',
options: {
plugins: [
{ removeTitle: true },
{ convertPathData: false },
{ removeUselessStrokeAndFill: true },
{ removeViewBox: false },
{
name: 'preset-default',
params: {
overrides: {
convertPathData: false,
removeViewBox: false,
},
},
},
'removeTitle',
'removeUselessStrokeAndFill',
],
},
},
Expand Down Expand Up @@ -55,6 +63,9 @@ const defaultRazzleOptions = {
};

module.exports = {
core: {
builder: 'webpack5',
},
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-links',
Expand Down Expand Up @@ -93,11 +104,20 @@ module.exports = {
options: {},
});

// putting SVG loader on top, fix the fileloader manually (Volto plugin does not
// work) since it needs to go first
config = scssPlugin.modifyWebpackConfig({
env: { target: 'web', dev: 'dev' },
webpackConfig: config,
webpackObject: webpack,
options: { razzleOptions: {} },
});

// Put the SVG loader on top and prevent the asset/resource rule
// from processing the app's SVGs
config.module.rules.unshift(SVGLOADER);
const fileLoader = config.module.rules.find(fileLoaderFinder);
fileLoader.exclude = [/\.(config|variables|overrides)$/, /icons\/.*\.svg$/];
const fileLoaderRule = config.module.rules.find((rule) =>
rule.test.test('.svg'),
);
fileLoaderRule.exclude = /icons\/.*\.svg$/;

config.plugins.unshift(
new webpack.DefinePlugin({
Expand All @@ -112,6 +132,7 @@ module.exports = {
resolve: {
...config.resolve,
alias: { ...config.resolve.alias, ...baseConfig.resolve.alias },
fallback: { ...config.resolve.fallback, zlib: false },
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@
"@storybook/addon-controls": "6.3.0",
"@storybook/addon-essentials": "^6.3.0",
"@storybook/addon-links": "^6.3.0",
"@storybook/builder-webpack5": "^6.5.15",
"@storybook/manager-webpack5": "^6.5.15",
"@storybook/react": "^6.3.0",
"razzle": "4.2.18",
"stylelint": "14.0.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/scripts/i18n.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ function poToJson({ registry, addonMode }) {
const addonItems = Pofile.parse(
fs.readFileSync(addonlocale, 'utf8'),
).items;
items = [...addonItems, ...items];
mergeMessages(result, items, lang);

mergeMessages(result, addonItems, lang);
if (require.main === module) {
// We only log it if called as script
console.log(`Merging ${addon} locales for ${lang}`);
Expand Down
2 changes: 1 addition & 1 deletion packages/volto-slate/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@plone/volto-slate",
"version": "17.0.0-alpha.24",
"version": "17.0.0-alpha.25",
"description": "Slate.js integration with Volto",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
29 changes: 18 additions & 11 deletions src/components/manage/Blocks/Listing/withQuerystringResults.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default function withQuerystringResults(WrappedComponent) {
} = props;
const { settings } = config;
const querystring = data.querystring || data; // For backwards compat with data saved before Blocks schema. Note, this is also how the Search block passes data to ListingBody

const subrequestID = content?.UID + '-' + id;
const { b_size = settings.defaultPageSize } = querystring; // batchsize

// save the path so it won't trigger dispatch on eager router location change
Expand Down Expand Up @@ -52,31 +52,33 @@ export default function withQuerystringResults(WrappedComponent) {

const folderItems = content?.is_folderish ? content.items : [];
const hasQuery = querystring?.query?.length > 0;
const hasLoaded = hasQuery ? querystringResults?.[id]?.loaded : true;
const hasLoaded = hasQuery
? querystringResults?.[subrequestID]?.loaded
: true;

const listingItems = hasQuery
? querystringResults?.[id]?.items || []
? querystringResults?.[subrequestID]?.items || []
: folderItems;

const showAsFolderListing = !hasQuery && content?.items_total > b_size;
const showAsQueryListing =
hasQuery && querystringResults?.[id]?.total > b_size;
hasQuery && querystringResults?.[subrequestID]?.total > b_size;

const totalPages = showAsFolderListing
? Math.ceil(content.items_total / b_size)
: showAsQueryListing
? Math.ceil(querystringResults[id].total / b_size)
? Math.ceil(querystringResults[subrequestID].total / b_size)
: 0;

const prevBatch = showAsFolderListing
? content.batching?.prev
: showAsQueryListing
? querystringResults[id].batching?.prev
? querystringResults[subrequestID].batching?.prev
: null;
const nextBatch = showAsFolderListing
? content.batching?.next
: showAsQueryListing
? querystringResults[id].batching?.next
? querystringResults[subrequestID].batching?.next
: null;

const isImageGallery =
Expand All @@ -86,7 +88,12 @@ export default function withQuerystringResults(WrappedComponent) {
useDeepCompareEffect(() => {
if (hasQuery) {
dispatch(
getQueryStringResults(initialPath, adaptedQuery, id, currentPage),
getQueryStringResults(
initialPath,
adaptedQuery,
subrequestID,
currentPage,
),
);
} else if (isImageGallery && !hasQuery) {
// when used as image gallery, it doesn't need a query to list children
Expand All @@ -104,7 +111,7 @@ export default function withQuerystringResults(WrappedComponent) {
},
],
},
id,
subrequestID,
),
);
} else {
Expand All @@ -113,7 +120,7 @@ export default function withQuerystringResults(WrappedComponent) {
adaptedQueryRef.current = adaptedQuery;
currentPageRef.current = currentPage;
}, [
id,
subrequestID,
isImageGallery,
adaptedQuery,
hasQuery,
Expand All @@ -126,7 +133,7 @@ export default function withQuerystringResults(WrappedComponent) {
<WrappedComponent
{...props}
onPaginationChange={(e, { activePage }) => setCurrentPage(activePage)}
total={querystringResults?.[id]?.total}
total={querystringResults?.[subrequestID]?.total}
batch_size={b_size}
currentPage={currentPage}
totalPages={totalPages}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import { useHistory } from 'react-router-dom';
import AnchorLink from 'react-anchor-link-smooth-scroll';
import Slugger from 'github-slugger';

const RenderListItems = ({ items, data, history }) => {
const RenderListItems = ({ items, data }) => {
const history = useHistory();

return map(items, (item) => {
const { id, level, title, override_toc, plaintext } = item;
const slug = override_toc
Expand Down Expand Up @@ -50,7 +52,6 @@ const RenderListItems = ({ items, data, history }) => {
* @extends Component
*/
const View = ({ data, tocEntries }) => {
const history = useHistory();
return (
<>
{data.title && !data.hide_title ? (
Expand All @@ -70,7 +71,7 @@ const View = ({ data, tocEntries }) => {
bulleted={!data.ordered}
as={data.ordered ? 'ol' : 'ul'}
>
<RenderListItems items={tocEntries} data={data} history={history} />
<RenderListItems items={tocEntries} data={data} />
</List>
</>
);
Expand Down

0 comments on commit d2c0124

Please sign in to comment.