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-6387 Allow import/export for all post types #1447

Merged
merged 3 commits into from Jan 18, 2022

Conversation

Inwerpsel
Copy link
Contributor

@Inwerpsel Inwerpsel commented Sep 13, 2021

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

Remove all checks for the "campaign" post type, as this logic works on other types as well.

Makes following things appear in the UI which were only on campaign pages previously:

  • Import button on the listing page. All types use the same import page URL, the type is in the imported XML.
  • Export button on the listing page for each post.

Otherwise the import is functionality that didn't need any further changes to work on all post types.

I took the liberty to also add an edit link to the post import output if it's successful. I imagine people will often want to edit it after import.
Screenshot from 2022-01-14 16-35-05

comzeradd pushed a commit to greenpeace/planet4-test-tavros that referenced this pull request Sep 13, 2021
/unhold cc36dc18-b5e3-4407-90c5-e1b68e4399c8
@planet-4
Copy link
Contributor

planet-4 commented Sep 13, 2021

Test instance is ready 🚀

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

⌚ 2022.01.18 12:55:48

comzeradd pushed a commit to greenpeace/planet4-test-tavros that referenced this pull request Sep 13, 2021
/unhold 275f8e26-b7da-44c7-9910-10f59133f5ac
comzeradd pushed a commit to greenpeace/planet4-test-tavros that referenced this pull request Sep 13, 2021
/unhold eafd4a95-efbe-4d7d-aac2-52b4bcb42301
@Inwerpsel Inwerpsel self-assigned this Jan 12, 2022
planet-4 added a commit to greenpeace/planet4-test-tavros that referenced this pull request Jan 12, 2022
/unhold d0601b6b-6cd0-4524-916f-bee716d26c93
src/Loader.php Outdated Show resolved Hide resolved
planet-4 added a commit to greenpeace/planet4-test-tavros that referenced this pull request Jan 14, 2022
/unhold 2bf0fddb-a3a7-4ec6-9cbb-65ca8cd5ab0c
Ref: https://jira.greenpeace.org/browse/PLANET-6387
* Remove all checks for the "campaign" post type, as this logic should
work on other types as well. This way workarounds are no longer needed
to import other types.
Ref: https://jira.greenpeace.org/browse/PLANET-6387
* I don't understand how the base import doesn't include this in the
output.
planet-4 added a commit to greenpeace/planet4-test-tavros that referenced this pull request Jan 14, 2022
/unhold 1040dd45-af7d-4f11-8d96-61abfdf55138
@Inwerpsel Inwerpsel marked this pull request as ready for review January 14, 2022 15:37
@Inwerpsel Inwerpsel changed the title Allow import/export for all post types PLANET-6387 Allow import/export for all post types Jan 14, 2022
@sagarsdeshmukh
Copy link
Member

Can we also change the files names? 🤔
CampaignExporter.php
CampaignImporter.php
as its applicable to all post types.

@@ -8,8 +8,8 @@

class_alias( \P4\MasterTheme\Activator::class, 'P4_Activator' );
class_alias( \P4\MasterTheme\AnalyticsValues::class, 'P4_Analytics_Values' );
class_alias( \P4\MasterTheme\CampaignExporter::class, 'P4_Campaign_Exporter' );
class_alias( \P4\MasterTheme\CampaignImporter::class, 'P4_Campaign_Importer' );
class_alias( \P4\MasterTheme\Exporter::class, 'P4_Campaign_Exporter' );
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can probably remove these aliases, might do that in a follow up.

planet-4 added a commit to greenpeace/planet4-test-tavros that referenced this pull request Jan 18, 2022
/unhold ff31691a-8c98-42ea-9e8f-09b9ec81bd2b
@sagarsdeshmukh
Copy link
Member

The post taxonomy import is looks like not working, we don’t have it in campaign post types, so didn’t cause any issue in past -
image

@sagarsdeshmukh
Copy link
Member

Other than taxonomy import issue PR looks good to me 👍

@Inwerpsel
Copy link
Contributor Author

The post taxonomy import is looks like not working, we don’t have it in campaign post types, so didn’t cause any issue in past - image

Could be this was never implemented, I don't find any code that looks like it should do this. Maybe it's even intentional, as I imagine usually editors don't want to have the import create new taxonomy items from another site. And it's quite challenging to map the imported taxonomy to the local one.

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

* It works for all types now.
* Preserve it on function that truly only relates to campaigns.
planet-4 added a commit to greenpeace/planet4-test-tavros that referenced this pull request Jan 18, 2022
/unhold 66b3c329-6479-434c-91a0-c3824d3cbd6d
@sagarsdeshmukh
Copy link
Member

The post taxonomy import is looks like not working, we don’t have it in campaign post types, so didn’t cause any issue in past - image

Could be this was never implemented, I don't find any code that looks like it should do this. Maybe it's even intentional, as I imagine usually editors don't want to have the import create new taxonomy items from another site. And it's quite challenging to map the imported taxonomy to the local one.

I agree that importing taxonomy, will be quite challenging.
We are using the wordpress importer plugin to import the data, which support's the Categories, tags and terms (from custom taxonomies and term meta) import.

@Inwerpsel Inwerpsel merged commit 76a1df7 into master Jan 18, 2022
@Inwerpsel Inwerpsel deleted the import-export-all-post-types branch January 18, 2022 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants