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

PLANET-7657: Add support for TA pages #2492

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

GP-Dan-Tovbein
Copy link
Contributor

@GP-Dan-Tovbein GP-Dan-Tovbein commented Jan 6, 2025

Summary

The ActionsList block might render the same content as the Covers block.


Ref: https://jira.greenpeace.org/browse/PLANET-7657

Testing

  1. Create a new page
  2. Add two blocks: ActionsList and Cover which will be needed to compare content

Then check:

  1. it's disabled, we should only fetch children pages of the page that is assigned as "Act Page" (same as the current Covers block).
  2. If it's enabled, we should fetch Actions (we already do that) but also the children pages of the page that is assigned as "Take Action Page"

@GP-Dan-Tovbein GP-Dan-Tovbein self-assigned this Jan 6, 2025
planet-4 added a commit to greenpeace/planet4-test-pandora that referenced this pull request Jan 7, 2025
/unhold a975c379-d207-4f97-ad06-c8f706f2396f
@planet-4
Copy link
Contributor

planet-4 commented Jan 7, 2025

Test instance is ready 🚀

🌑 pandora | admin | blocks report | CircleCI | composer-local.json

⌚ 2025.01.09 20:07:44

@GP-Dan-Tovbein GP-Dan-Tovbein force-pushed the PLANET-7657_add-support-for-take-action-pages branch from f920545 to e453553 Compare January 9, 2025 19:49
planet-4 added a commit to greenpeace/planet4-test-pandora that referenced this pull request Jan 9, 2025
/unhold 50f41f82-232f-4ceb-860f-0f16e2dc2acc
@GP-Dan-Tovbein GP-Dan-Tovbein force-pushed the PLANET-7657_add-support-for-take-action-pages branch from e453553 to 40999b8 Compare January 9, 2025 19:54
planet-4 added a commit to greenpeace/planet4-test-pandora that referenced this pull request Jan 9, 2025
/unhold b5d2ff18-b0dd-4bfb-97d7-627deda67876
- Sanitize query params
@GP-Dan-Tovbein GP-Dan-Tovbein force-pushed the PLANET-7657_add-support-for-take-action-pages branch from 40999b8 to 5156bd0 Compare January 9, 2025 19:58
planet-4 added a commit to greenpeace/planet4-test-pandora that referenced this pull request Jan 9, 2025
/unhold 7a30da37-8206-4cf9-8f18-6edfefd710d0
@@ -43,13 +43,26 @@ public static function registerFrontendQuery(): void
'query_loop_block_query_vars',
function ($query, $block) {
$blockQuery = $block->context['query'] ?? [];

// Sanitize query only applied to ActionsList block.
if ((bool) array_key_exists('isCustomQueryLoop', $blockQuery)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to check this to avoid apply this changes to the native core/query query.

const IS_NEW_IA = window.p4_vars.options.new_ia;
const queryPostType = IS_NEW_IA ? 'p4_action' : 'page';

if(query.postType !== queryPostType) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to implement this since the query passed through attributes (1) it's not the same as the one needed by the query loop (2)

For instance:
(1)

{
   "post_type":"page",
   "order":"DESC",
   "orderby":"date",
   "post__not_in":[
      2067
   ],
   "tax_query":[
      
   ],
   "offset":0,
   "posts_per_page":3,
   "author__in":[]
}

(2)

{
   "pages":0,
   "perPage":3,
   "offset":0,
   "order":"desc",
   "orderBy":"date",
   "postStatus":"publish",
   "author":"",
   "search":"",
   "exclude":[
      2067
   ],
   "sticky":"",
   "inherit":false,
   "postType":"page",
   "postIn":[
      
   ],
   "hasPassword":false,
   "parent":9,
   "post_parent":9
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants