[MGNLHOOK-302] Modifiying the type of a declared event definition for a webhook file, does not remove previous subscriber, on SaaS Created: 02/Dec/22  Updated: 11/Jan/23  Resolved: 11/Jan/23

Status: Closed
Project: Magnolia Webhooks
Component/s: None
Affects Version/s: 2.0.0
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Javier Benito Assignee: Jaroslav Simak
Resolution: Fixed Votes: 0
Labels: None
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: Not Specified Time Spent: Not Specified
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Sub-Tasks:
Key
Summary
Type
Status
Assignee
MGNLHOOK-318 Implementation Sub-task Completed Jaroslav Simak  
MGNLHOOK-319 Review Sub-task Completed Milan Divilek  
MGNLHOOK-320 piQA Sub-task Completed Milan Divilek  
MGNLHOOK-321 QA Sub-task Completed Javier Benito  
Team: DeveloperX
Date of First Response:
Epic Link: Webhook on SaaS
Sprint: DevX 28
Story Points: 3

 Description   

Steps to reproduce

  • Create a webhook definition file, with an event definition. Push it to GIT
  • Test that it's triggered properly, publishing/unpublishing content, depending on the event type declared.
  • Change the event type to the other one (Published <-> Unpublished). Push it to GIT.
  • If content is published or unpublished, both type of events are triggered.

Expected results

When event type is changed to the other one, existing subscriber should be removed.

Developer notes

The problem occurs because on method info.magnolia.webhooks.registry.WebhookDefinitionRegistry#onUpdate, when it is invoked with the webhook definition change (event type), lastValidDefinitions, already contains it (it's supposed to have only the previous definition). The only place where lastValidDefinitions is updated, is at the end of method info.magnolia.webhooks.registry.WebhookDefinitionRegistry#updateProvider, which hasn't yet been executed when the first method one is invoked (in fact, it's being executed in the first method line, inside a loop).

For QA:

  • Test also on different environments


 Comments   
Comment by Christopher Zimmermann [ 12/Dec/22 ]

Seems kind of wierd - does this happen with other kinds of definitions?? If not, what is special about webhooks thaat makes it susceptible to this kind of bug?

Generated at Mon Feb 12 10:02:56 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.