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-7511 Migrate Articles block to Posts List block #2491

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

sagarsdeshmukh
Copy link
Member

@sagarsdeshmukh sagarsdeshmukh commented Dec 31, 2024

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

Summary

Articles block migration to post List block


Testing

  1. Run this PR in your local environment.
  2. Add an Articles block to a post or page. You can also directly copy/paste block code snippet below in the code editor:
<!-- wp:planet4-blocks/articles -->
<div class="wp-block-planet4-blocks-articles"><div data-hydrate="planet4-blocks/articles" data-attributes="{&quot;article_heading&quot;:&quot;Related Articles&quot;,&quot;articles_description&quot;:&quot;&quot;,&quot;article_count&quot;:3,&quot;tags&quot;:[],&quot;posts&quot;:[],&quot;post_types&quot;:[],&quot;read_more_text&quot;:&quot;Load more&quot;,&quot;read_more_link&quot;:&quot;&quot;,&quot;button_link_new_tab&quot;:false,&quot;ignore_categories&quot;:false}"></div></div>
<!-- /wp:planet4-blocks/articles -->

<!-- wp:planet4-blocks/articles {"article_heading":"Articles block with Select tags","articles_description":"Test description\u003cbr\u003eTags: Climate, Consumption, Oceans","article_count":4,"tags":[6,8,26]} -->
<div class="wp-block-planet4-blocks-articles"><div data-hydrate="planet4-blocks/articles" data-attributes="{&quot;article_heading&quot;:&quot;Articles block with Select tags&quot;,&quot;articles_description&quot;:&quot;Test description&lt;br&gt;Tags: Climate, Consumption, Oceans&quot;,&quot;article_count&quot;:4,&quot;tags&quot;:[6,8,26],&quot;posts&quot;:[],&quot;post_types&quot;:[],&quot;read_more_text&quot;:&quot;Load more&quot;,&quot;read_more_link&quot;:&quot;&quot;,&quot;button_link_new_tab&quot;:false,&quot;ignore_categories&quot;:false}"></div></div>
<!-- /wp:planet4-blocks/articles -->

<!-- wp:planet4-blocks/articles {"article_heading":"Articles block with Post types","articles_description":"test description\u003cbr\u003epost types: story, Press Release","article_count":2,"post_types":[16,14]} -->
<div class="wp-block-planet4-blocks-articles"><div data-hydrate="planet4-blocks/articles" data-attributes="{&quot;article_heading&quot;:&quot;Articles block with Post types&quot;,&quot;articles_description&quot;:&quot;test description&lt;br&gt;post types: story, Press Release&quot;,&quot;article_count&quot;:2,&quot;tags&quot;:[],&quot;posts&quot;:[],&quot;post_types&quot;:[16,14],&quot;read_more_text&quot;:&quot;Load more&quot;,&quot;read_more_link&quot;:&quot;&quot;,&quot;button_link_new_tab&quot;:false,&quot;ignore_categories&quot;:false}"></div></div>
<!-- /wp:planet4-blocks/articles -->

<!-- wp:planet4-blocks/articles {"article_heading":"Articles block with Manual override posts ","articles_description":"Test description\u003cbr\u003eManual override Posts","article_count":5,"posts":[256,260,263,1107,1111,1113]} -->
<div class="wp-block-planet4-blocks-articles"><div data-hydrate="planet4-blocks/articles" data-attributes="{&quot;article_heading&quot;:&quot;Articles block with Manual override posts &quot;,&quot;articles_description&quot;:&quot;Test description&lt;br&gt;Manual override Posts&quot;,&quot;article_count&quot;:5,&quot;tags&quot;:[],&quot;posts&quot;:[256,260,263,1107,1111,1113],&quot;post_types&quot;:[],&quot;read_more_text&quot;:&quot;Load more&quot;,&quot;read_more_link&quot;:&quot;&quot;,&quot;button_link_new_tab&quot;:false,&quot;ignore_categories&quot;:false}"></div></div>
<!-- /wp:planet4-blocks/articles -->

<!-- wp:planet4-blocks/articles {"article_heading":"","articles_description":"empty title"} -->
<div class="wp-block-planet4-blocks-articles"><div data-hydrate="planet4-blocks/articles" data-attributes="{&quot;article_heading&quot;:&quot;&quot;,&quot;articles_description&quot;:&quot;empty title&quot;,&quot;article_count&quot;:3,&quot;tags&quot;:[],&quot;posts&quot;:[],&quot;post_types&quot;:[],&quot;read_more_text&quot;:&quot;Load more&quot;,&quot;read_more_link&quot;:&quot;&quot;,&quot;button_link_new_tab&quot;:false,&quot;ignore_categories&quot;:false}"></div></div>
<!-- /wp:planet4-blocks/articles -->
  1. Run the migrator command: npx wp-env run cli wp p4-run-activator
  2. Check whether the migration worked as expected.
  3. To reset the environment database back to the latest default content and repeat the tests, run: npm run db:reset.

planet-4 added a commit to greenpeace/planet4-test-mars that referenced this pull request Dec 31, 2024
/unhold a8b1ce39-7c7f-4eca-a817-cd74f7680ba0
@planet-4
Copy link
Contributor

planet-4 commented Dec 31, 2024

Test instance is ready 🚀

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

⌚ 2025.02.26 11:17:48

@sagarsdeshmukh sagarsdeshmukh force-pushed the PLANET-7511-migrate_articles_block branch from f8a61a5 to e6736b7 Compare February 3, 2025 16:34
planet-4 added a commit to greenpeace/planet4-test-mars that referenced this pull request Feb 3, 2025
/unhold 6668ccc3-9386-4552-8182-7600ba07a0ca
@sagarsdeshmukh sagarsdeshmukh force-pushed the PLANET-7511-migrate_articles_block branch from e6736b7 to 3993207 Compare February 3, 2025 16:42
planet-4 added a commit to greenpeace/planet4-test-mars that referenced this pull request Feb 3, 2025
/unhold 2dba4af6-382d-45fd-a43f-9108d1c5aee6
@sagarsdeshmukh sagarsdeshmukh force-pushed the PLANET-7511-migrate_articles_block branch from 3993207 to 212db5a Compare February 5, 2025 10:04
planet-4 added a commit to greenpeace/planet4-test-mars that referenced this pull request Feb 5, 2025
/unhold ee3dddf2-f9f9-48be-bf9d-5c48835cd091
@sagarsdeshmukh sagarsdeshmukh force-pushed the PLANET-7511-migrate_articles_block branch from 212db5a to 9a092ce Compare February 10, 2025 23:42
planet-4 added a commit to greenpeace/planet4-test-mars that referenced this pull request Feb 10, 2025
/unhold 6f04344f-0299-480f-abf9-4bf93f5e3adf
@sagarsdeshmukh sagarsdeshmukh force-pushed the PLANET-7511-migrate_articles_block branch from 9a092ce to 6984297 Compare February 10, 2025 23:47
planet-4 added a commit to greenpeace/planet4-test-mars that referenced this pull request Feb 10, 2025
/unhold 955a65df-9df0-4ecc-bff2-c763d13bf805
@sagarsdeshmukh sagarsdeshmukh force-pushed the PLANET-7511-migrate_articles_block branch from 6984297 to 0564fe7 Compare February 10, 2025 23:56
planet-4 added a commit to greenpeace/planet4-test-mars that referenced this pull request Feb 10, 2025
/unhold ca571e83-bc0d-4a2d-afcd-22998820d444
@sagarsdeshmukh sagarsdeshmukh force-pushed the PLANET-7511-migrate_articles_block branch from 0564fe7 to bbc115b Compare February 11, 2025 02:39
planet-4 added a commit to greenpeace/planet4-test-mars that referenced this pull request Feb 11, 2025
/unhold e95ee361-6e8a-4a1f-87fb-f39be27f6d1c
@sagarsdeshmukh sagarsdeshmukh force-pushed the PLANET-7511-migrate_articles_block branch from bbc115b to 981c121 Compare February 11, 2025 02:58
planet-4 added a commit to greenpeace/planet4-test-mars that referenced this pull request Feb 11, 2025
/unhold 43c65240-9a63-4742-9fe1-50ef3ac9d98f
@sagarsdeshmukh sagarsdeshmukh marked this pull request as ready for review February 11, 2025 03:21
@sagarsdeshmukh sagarsdeshmukh requested review from Osong-Michael, a team and mleray and removed request for a team February 11, 2025 03:22
@sagarsdeshmukh sagarsdeshmukh self-assigned this Feb 11, 2025
@sagarsdeshmukh sagarsdeshmukh force-pushed the PLANET-7511-migrate_articles_block branch from 981c121 to b98247d Compare February 11, 2025 05:13
planet-4 added a commit to greenpeace/planet4-test-mars that referenced this pull request Feb 11, 2025
/unhold e17844f7-4afc-4f46-bd6e-aecba7ce66fe
@sagarsdeshmukh sagarsdeshmukh added the UAT Needed This PR requires User Acceptance Tests before merge label Feb 12, 2025
planet-4 added a commit to greenpeace/planet4-test-mars that referenced this pull request Feb 24, 2025
/unhold ceb9e6cd-bde4-40fa-a05c-c9ce05aebc60
planet-4 added a commit to greenpeace/planet4-test-mars that referenced this pull request Feb 24, 2025
/unhold 9aab267c-e29f-4254-a8c4-d47c7752f3d0
planet-4 added a commit to greenpeace/planet4-test-mars that referenced this pull request Feb 24, 2025
/unhold 17294fa0-c8b9-4dad-af3c-6ec0f4fee413
@sagarsdeshmukh sagarsdeshmukh force-pushed the PLANET-7511-migrate_articles_block branch from 4ed4756 to 8995f08 Compare February 24, 2025 13:07
planet-4 added a commit to greenpeace/planet4-test-mars that referenced this pull request Feb 24, 2025
/unhold 02d86a41-d205-4394-b436-49fc756d1e84
@sagarsdeshmukh sagarsdeshmukh force-pushed the PLANET-7511-migrate_articles_block branch from 8995f08 to 72e375d Compare February 24, 2025 13:25
planet-4 added a commit to greenpeace/planet4-test-mars that referenced this pull request Feb 24, 2025
/unhold ad7efc2a-1e3c-49da-98a9-0069ee3291a0
Copy link
Contributor

@Osong-Michael Osong-Michael left a comment

Choose a reason for hiding this comment

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

👍 tested on local, works as expected

@sagarsdeshmukh sagarsdeshmukh added UAT Passed User Acceptance Tests passed and removed UAT Needed This PR requires User Acceptance Tests before merge labels Feb 25, 2025
Copy link
Contributor

@mardelnet mardelnet left a comment

Choose a reason for hiding this comment

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

@sagarsdeshmukh, shouldn't we remove the Articles block from the codebase, too?

@sagarsdeshmukh
Copy link
Member Author

@sagarsdeshmukh, shouldn't we remove the Articles block from the codebase, too?

Yes, we should, but I’m waiting for confirmation on how to handle the 'Include Articles In Post' option if we remove the articles block. I’ve added a comment on JIRA.

Copy link
Contributor

@mardelnet mardelnet left a comment

Choose a reason for hiding this comment

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

Nice job @sagarsdeshmukh!
We also have to migrate the Additional CSS class(es).

planet-4 added a commit to greenpeace/planet4-test-mars that referenced this pull request Feb 26, 2025
/unhold e5fbb85f-ee71-402b-a0a6-f78c6b6d4481
@sagarsdeshmukh sagarsdeshmukh force-pushed the PLANET-7511-migrate_articles_block branch from 63f3705 to 7125b5e Compare February 26, 2025 06:29
planet-4 added a commit to greenpeace/planet4-test-mars that referenced this pull request Feb 26, 2025
/unhold 2f7b391f-4f6a-4609-acc8-e4180d401c6d
Copy link
Contributor

@mardelnet mardelnet left a comment

Choose a reason for hiding this comment

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

@sagarsdeshmukh, we also have to migrate the Additional CSS class(es):

Edit-Page-‹-Greenpeace-—-WordPress

Copy link
Contributor

@mardelnet mardelnet left a comment

Choose a reason for hiding this comment

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

This is very picky and completely optional: I wonder if we should create a separate class for Query blocks since this migration and migration M037 share most of the code. By moving the reusable code to a separate class, it will be easier and faster to migrate Query blocks in the future and we'll avoid the Sonar Cloud analysis to fail because of duplicated code.

@Osong-Michael
Copy link
Contributor

@sagarsdeshmukh, we also have to migrate the Additional CSS class(es):

Edit-Page-‹-Greenpeace-—-WordPress

Those classes we already add here, WP declares them as "Additional classes" since we added them during the block variation regsitration

@mardelnet
Copy link
Contributor

@sagarsdeshmukh, we also have to migrate the Additional CSS class(es):

Those classes we already add here, WP declares them as "Additional classes" since we added them during the block variation regsitration

Thanks @Osong-Michael
Locally, when I add a new additional class to the Articles block, that class is not part of the Post List block after running the migration script.

planet-4 added a commit to greenpeace/planet4-test-mars that referenced this pull request Feb 26, 2025
/unhold 0ffcbf83-778c-44ca-89b1-74629cd231f8
Remove Articles block tests styles, JS and php code
planet-4 added a commit to greenpeace/planet4-test-mars that referenced this pull request Mar 4, 2025
/unhold ff193c34-22c0-4f84-aabb-3a4431b925cf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Review [Test Env] mars UAT Passed User Acceptance Tests passed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants