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

Deleting drafts triggers site.changed webhook #21699

Open
1 task done
alexgmathews opened this issue Nov 22, 2024 · 1 comment
Open
1 task done

Deleting drafts triggers site.changed webhook #21699

alexgmathews opened this issue Nov 22, 2024 · 1 comment

Comments

@alexgmathews
Copy link

alexgmathews commented Nov 22, 2024

Issue Summary

Deleting draft posts triggers the site.changed webhook. I assume, though, that site.changed is supposed to mean "something happened that changed the website's published1 front-end content." Accordingly, creating a draft post and updating a draft post do not trigger the site.changed webhook.

Why It Matters

I use the site.changed webhook to trigger cache purges. When I delete a draft post, the site.changed webhook clears my front-end cache, even though there weren't any changes to the website's published front-end content.

Steps to Reproduce

  1. Create a site.changed webhook for monitoring
  2. Create and save a draft post
  3. Delete the draft post
  4. Check the [last triggered] status of the site.changed webhook

Thoughts on Resolution

The post.unpublished webhook triggers when a published post is unpublished either by means of being reverted to draft status or by being deleted. It avoids triggering when a draft post is deleted. Could similar logic be used as part of the site.changed webhook?

I assume the issue also applies to deleting draft pages, but I haven't tested.

Ghost Version

6.101.1

Node.js Version

18.20.4

How did you install Ghost?

Docker ghost:5-alpine

Database type

MySQL 8

Code of Conduct

  • I agree to be friendly and polite to people in this repository

Footnotes

  1. From personal testing, e-mail-only posts and previews seem excluded from Ghost's definition of "published"

@github-actions github-actions bot added the needs:triage [triage] this needs to be triaged by the Ghost team label Nov 22, 2024
@alexgmathews alexgmathews changed the title Deleting unpublished posts triggers site.changed webhook Deleting draft posts triggers site.changed webhook Nov 22, 2024
@alexgmathews alexgmathews changed the title Deleting draft posts triggers site.changed webhook Deleting drafts triggers site.changed webhook Nov 22, 2024
@linear linear bot added P4 - Low and removed needs:triage [triage] this needs to be triaged by the Ghost team labels Nov 22, 2024
@ErisDS
Copy link
Member

ErisDS commented Dec 11, 2024

Thanks for the bug report - you've assessed correctly, this is very much unexpected behaviour.

Would love a PR for this if you fancy taking a stab at a fix 🙏

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

No branches or pull requests

2 participants