Moved event emitter middleware to api app #10233
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes #10226
site.changed
events from v2 admin api to apiApp.Context
We added a new webhook recently which is triggered on
site.changed
event. The middleware responsible for emitting this event was configured directly to v2 admin api as Admin client was already updated to use v2 APIs.Problem
While most of the APIs were moved to v2, the post-scheduling adapter is still using default API set which is v0.1 currently. So any scheduled post is published via old APIs which in turn does not trigger the event/webhook for
site.changed
.FIX: Moving the emit-event middleware one level up to api app, so it listens to all API response across api versions and fires
site.changed
event/webhook when needed. Afaik it shouldn't have any side effects on existing event flow as its based on cache-invalidation header in response. The alternate is to narrow it down and add the middleware directly to v0.1 app but till the time we don't have api version specific middleware for this event, it made more sense to add it here.