alleyinteractive / apple-news

The Publish to Apple News plugin enables your WordPress blog content to be published to your Apple News channel.
https://wordpress.org/plugins/publish-to-apple-news/
GNU General Public License v3.0
155 stars 71 forks source link

Add Support for Handling Deleted Articles #1154

Closed bmcnulty7 closed 3 weeks ago

bmcnulty7 commented 2 months ago

Description

I would like to see support for removing the Apple News article metadata in WP if it tries to get info on the articles from the News API and the News API reports that the article doesn't exist, so that error messages are no longer thrown for this scenario.

Use Case

When a post is deleted directly in iCloud News Publisher, the postmeta should be updated in WP if the News API reports a 404 so the request to fetch the article doesn't continue.

Acceptance Criteria

renatonascalves commented 1 month ago

I think I have one small editorial concern/clarification about this suggested approach.

Currently, if a post is deleted directly from iCloud News Publisher, an editor can still see an error message as to why the post was not updated in Apple News (the error message is cryptic but that's a separate issue).

CleanShot 2024-09-10 at 21 45 34@2x

By doing what the AC is asking, resetting the post data, the same post would be added to Apple News again, the next time it was updated. Which I'd expect to be not the original goal of the editor, since it was probably deleted from Apple News for a specific purpose.

The editorial intent here might be important. Did the editor choose to delete it from Apple News? Do they not want to readd this article to Apple News?

Aside: I do see an option "Hidden Article" to hide it in Apple News, but I don't see an option (except via code), to purposefully not to index a specific post.

cc: @bmcnulty7, @kevinfodness

renatonascalves commented 1 month ago

Another editorial pespective here is that, if an editor deleted the article in Apple News by mistake, and then they update the post. The article won't sync to Apple News because the data is out of sync (deleted in Apple News but present in the article post meta).

Which in theory, an editor wants the article to be sent to Apple News, they just can't currently force it (see #1008). And the update sort of goes into a loop (due to out of sync data).

kevinfodness commented 1 month ago

In my experience, there's more frustration over being in the "stuck state" where they want to push an article to Apple News but can't because the ID is out of sync. If the site is set to auto-publish articles to Apple News, there would be an expectation that hitting "Publish" means that an article goes to Apple News. If they don't want that, they need to either a) turn off autopublish or b) set up rules to make articles that match certain term IDs (for example) not publish. Term ID exclusions are available on the settings screen. By keeping the data in sync here, it matches the experience of converting an article to a draft (which deletes it from Apple News) then republishing it (which causes it to be pushed to Apple News again).

renatonascalves commented 1 month ago

Removing myself since I'll be leaving for PTO/vacation. But the pr is good and it is pending further testing on a live/testing site. 🎈

renatonascalves commented 1 month ago

@kevinfodness Not sure if you agree, but I opted to show a message instead of an error message or silently reindexing. Let me know if you have any objections.

CleanShot 2024-10-03 at 12 55 08@2x