-
-
Notifications
You must be signed in to change notification settings - Fork 3k
FIX: Custom Point Action triggering and form #13868
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 5.1 #13868 +/- ##
=========================================
Coverage 62.25% 62.26%
- Complexity 34217 34218 +1
=========================================
Files 2251 2251
Lines 102327 102328 +1
=========================================
+ Hits 63705 63711 +6
+ Misses 38622 38617 -5
|
…epreciation notice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good 👍
@putzwasser can you please rebase or cherrypick the commits on top of the 5.x branch? There will be no more releases for 5.1 |
@putzwasser thanks! Could you copy the PR description from this PR to #14218 and close this one? |
* TASK: Removes `GenericPointSettingsType` from ajax call * TASK: Removes GenericPointSettingsType * FIX: Makes PointBundle `EventHelper` use the right array item to access points * FIX: Sets initiated state * TASK: Adds test * FIX: phpstan * TASK: Re-creates `GenericPointSettingsType.php` for semver and adds depreciation notice
Description
Before this PR fixes two related bugs in the custom Point Action extension logic.
Change points (+/-)
input element) gets shown.Change points (+/-)
input element at the top. This field is ignored by the default attribution logic. It uses the second and redundant input element.What 2 means: If you provide your own action property form, you can't set a point change value that Mautic will use. Your action gets triggered but no points change is applied.
Side-note: Why do the built-in point actions work, then? ⇒ Because they also provide their own
callback
in their config (I won't go into detail here, but this obfuscated this bug, as their actions and trigger/attribution conditions are more complex).The form
Before this PR Mautic added the
GenericPointSettingsType
to the Point Action form, if the custom action doesn't provide its own property form type. This form type renders theChange points (+/-)
input element a second time.Point attribution
Before this PR the
Mautic\PointBundle\Helper\EventHelper::engagePointAction
tried to find the point change value in the custom action's attributes.This made it necessary to use the second (and redundant; marked red above) points delta input element. If you provided your own property form type Mautic always applied a point change value of
0
.So, basically: Mautic ignored what you've entered in the top the
Change points (+/-)
input element.📋 Steps to test this PR:
TestPointSubscriber
to your Mautic instance (put it in anyEventListener
folder)Hello World - My custom action
action in theAction taken by contact
form elementChange points (+/-)
input element gets addedSample Listener
This listener registers an example custom point action and an event listener to the
LeadEvents::LEAD_IDENTIFIED
event that triggers the point action.