Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only return visible elements from Pages elements relations #1590

Merged

Conversation

tvdeyen
Copy link
Member

@tvdeyen tvdeyen commented Jun 17, 2019

What is this pull request for?

Only return visible elements from Pages elements and fixed_elements relations.
Before we only return not trashed elements, but as discussed in #1587 is is very confusing to have hidden elements returned as well.

Refs #1587

Notable changes

This now always return not-trashed and visible elements from page.elements calls. If - for any reason - you want to have all elements (even trashed and invisible elements) you have to use the newly introduced all_elements relation.

@tvdeyen tvdeyen added this to the 4.3 milestone Jun 17, 2019
@tvdeyen tvdeyen force-pushed the page-elements-always-available-only branch from e1b0dd1 to 461462f Compare June 17, 2019 21:03
We have scopes on the page.elements relation that makes it
impossible to get all elements from a page.
Instead of using the page.elements relation that is meant to be
used by frontend devs and rely on that relation to never change
we use explicit scopes to load exactly the elements we need in
the admin.
These two relations were only used in one method. We can create
the necessary query in that method instead.
This relation was only used in two internal methods and was never meant
to be public API.
We already only return untrashed elements from these relations.
It does not make sense to include unvisible elements.

Refs AlchemyCMS#1587
The available scope is the default scope for Pages elements
relation.
The available scope is now the default scope for Pages elements
relation.
@tvdeyen tvdeyen force-pushed the page-elements-always-available-only branch from 461462f to ec6a844 Compare June 18, 2019 06:48
@tvdeyen tvdeyen merged commit 80b742f into AlchemyCMS:master Jun 18, 2019
@tvdeyen tvdeyen deleted the page-elements-always-available-only branch June 18, 2019 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants