Skip to content

Deleting drafts triggers site.changed webhook #21699

Open
@alexgmathews

Description

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"

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions