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

Maut 11460: Dynamic content in email builder filtered on custom object values #352

Merged
merged 42 commits into from
Jul 18, 2024

Conversation

avikarshasaha
Copy link
Contributor

@avikarshasaha avikarshasaha commented Jun 18, 2024

Q A
Bug fix? (use the a.b branch) [ Y]
New feature/enhancement? (use the a.x branch) [ N]
Deprecations? [ N]
BC breaks? (use the c.x branch) [N ]
Automated tests included? [ Y]
Related user documentation PR URL
Related developer documentation PR URL
Issue(s) addressed https://acquia.atlassian.net/browse/MAUT-11460

Description:

Dynamic content in email builder filtered on custom object values

Steps to test this PR:

Create a segment email with dynamic content with one or more variations.
The variations should be based on the filters of Custom Object.
Then, trigger/preview the email to the selected contacts that fall under the configured variations.
Users should receive dynamic content depending on Custom Object filter

Other areas of Mautic that may be affected by the change:

List deprecations along with the new alternative:

List of areas covered by the unit and/or functional tests:

@avikarshasaha avikarshasaha changed the title Maut 11460 Maut 11460: Dynamic content in email builder filtered on custom object values Jun 18, 2024
@avikarshasaha avikarshasaha requested review from a team, fedys and dadarya0 and removed request for a team June 18, 2024 11:56
Copy link
Contributor

@fedys fedys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found several major/minor issues. Please address them. I will continue with my review once the issues are addressed.

EventListener/TokenSubscriber.php Outdated Show resolved Hide resolved
EventListener/TokenSubscriber.php Outdated Show resolved Hide resolved
EventListener/TokenSubscriber.php Outdated Show resolved Hide resolved
EventListener/TokenSubscriber.php Outdated Show resolved Hide resolved
EventListener/TokenSubscriber.php Outdated Show resolved Hide resolved
@avikarshasaha avikarshasaha requested a review from fedys June 20, 2024 07:50
Copy link
Contributor

@fedys fedys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my code comments.

EventListener/TokenSubscriber.php Outdated Show resolved Hide resolved
@fedys
Copy link
Contributor

fedys commented Jun 20, 2024

@avikarshasaha will your changes work when there is a chain of custom items (Contact -> Custom Item -> Custom Item)?

EventListener/TokenSubscriber.php Outdated Show resolved Hide resolved
@fedys
Copy link
Contributor

fedys commented Jun 21, 2024

@avikarshasaha will your changes work when there is a chain of custom items (Contact -> Custom Item -> Custom Item)?

On today's DSU we decided not to support the chaining within this ticket/PR.

Copy link
Contributor

@dadarya0 dadarya0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failing if email variant have both custom object and lead type fields filter together.

dadarya0
dadarya0 previously approved these changes Jul 11, 2024
fedys
fedys previously approved these changes Jul 11, 2024
@avikarshasaha avikarshasaha dismissed stale reviews from fedys and dadarya0 via b0db023 July 12, 2024 05:22
@avikarshasaha avikarshasaha requested review from fedys and dadarya0 July 12, 2024 09:04
fedys
fedys previously approved these changes Jul 12, 2024
dadarya0
dadarya0 previously approved these changes Jul 12, 2024
@avikarshasaha avikarshasaha dismissed stale reviews from dadarya0 and fedys via 8011c8b July 17, 2024 14:54
@avikarshasaha avikarshasaha requested review from fedys and dadarya0 July 17, 2024 15:05
@avikarshasaha avikarshasaha merged commit 6ad2360 into staging Jul 18, 2024
3 checks passed
@avikarshasaha avikarshasaha deleted the MAUT-11460 branch July 18, 2024 10:14
escopecz added a commit that referenced this pull request Jan 13, 2025
* PHPStan fix again

* PHPStan

* PHPStan

* PHPStan

* Update README.md

* Remove PUT from the available item operations for the custom_objects endpoint.

* as PUT method is removed we are using PATCH insted

* fix segement filter issue in custom object

* fix test cases

* add code coverage

* fix phpstan issue

* fix failing test case

* fixing patch request

* skip setDefaultValuesForMissingFields for patch request

* adding comment

* updating note for implementation

* Fix warnings in test suite for PHP8.0 upgrade

* Remove unused import

Co-authored-by: Saurabh Gupta <[email protected]>

* check lead exist before link to custom item

* fixed tests

* adding tests

* removed php8 only compatibal code

* change warning type

* correct message

* changed warning type

* fix tests

* check for method exists and csfix

* Add merge filter query

* Remove const is defined check

* Fix test case by adding config param

* Add function to check if custom object filters are mergable

* Revert CustomFieldFilterQueryBuilder

* Update services

* Add CustomObjectMergedFilterQueryBuilder

* Use CustomObjectMergedFilterQueryBuilder

* Check for custom item filter

* Change merge filter logic

* Make consts

* Fix test cases

* Test with custom_object_merge_filter param

* Move test to appropriate class name

* Rename test case

* Rename test case

* Revert unnecessary code

* Remove union return type declaration in favour of PHP7.4

* Remove not exists in favour of negative filters

* Fix contact not getting added when one segment filter is used

* fix dependencies

* add parent constructor call

* remove duplicate dependencies; change deprecated methods

* fix inserting variable into string

* fix an event dispatching issue

* fix import with contact ids

* fix the allowed memory size exhausted issue

* fix the inheritance model issue

* Handling custom item links when merging contacts

* Adding GH Actions config

* Adding PHPSTAN Baseline for existing issues

* Remove dead code flagged by Rector

* Fixing PHPUNIT config

* Debugging tests

* PHPSTAN baseline for each PHP version

* Fixing tests

* Some tests require theofidry/alice-data-fixtures

* Test gh-actions

* tests.yaml update

* PHPSTAN baseline (debug) update

* Comment PHPUNIT TESTS

* Comment Coverage Report step

* skip test

* skip test

* revert

* print commit id

* Push commit to mc-cs

* Push commit to mc-cs

* Push commit to mc-cs

* Push commit to mc-cs

* Push commit to mc-cs

* Push commit to mc-cs

* static analysis add

* Moving Install composer up and comment phpstan baseline

* Upgrade php and mysql version

* Uncoomment PHPSTAN step

* comment phpstan

* Debug: regenerating PHPSTAN baseline

* Updating PHPSTAN baseline, enabling PHPSTAN check

* Clearing up the baseline files to generate them from scratch

* Running PHPSTAN with fresh baselines

* Updating action versions to avoid NodeJS warnings

* Removing the pull_request settings hoping the CI will run on the commit without merging to staging

* Disabling composer cache as theofidry/alice-data-fixtures doesn't seem to be present

* Would it help to run the commands separately?

* Or lock the version?

* The dependency must be also set in kernel. Let's skip the tests that need it for now

* The coverage report contains whole Mautic. Testing something different

* Fixing kernel class

* Another attempt to resolve the kernel class issue

* Do we need to set KERNEL_CLASS?

* Check API request by the controller name

* fix customobject fetch from typeoparatorprovider

* split into 2 line

* var name change

* empty and neq operator fixed

* pass true for $filterAlreadyNegated only from CustomFieldFilterQueryBuilder

* CustomItemRelationQueryBuilderTestCase was not included within the test suite as its name didn't end with "Test"

* Added functional tests for "not equal" and "empty" operators

* adding KERNEL_CLASS

* fixing test

* fixing tests

* Update Tests/Functional/Segment/Query/Filter/NegativeOperatorFilterQueryBuilderTest.php

Co-authored-by: Avikarsha Saha <[email protected]>

* enabling phpstan and fixed issues

* I think composer install should run after install mautic

* removed dependacy install after mautic installation

* removed vendor from scanDirectories from neon file

* added between/not between operator for date type field

* fix sonar issue

* add functional test case

* fix syntax

* fix issue for development branch failing

* Adding inTheLast and inTheNext operator for dat and datetime type fields

* Fixed CampaignConditionTest

* phpstan-ignore

* phpstan-ignore

* Comments for workarounds

* CS fixes

* NegativeOperatorFilterQueryBuilderTest fixed

* NegativeOperatorFilterQueryBuilderTest fixed

* Update Helper/QueryFilterHelper.php

Co-authored-by: Aarohi Prasad <[email protected]>

* fixc s

* fix date issue if empty/not empty filter is used

* fixed UI for between op, test case WIP

* fix phpstan

* Functioning code and test case for custom item between query for numbers

* better handling of types

* php7.4 syntax

* removed php 8 only syntax

* added test case for where assertion

* fix failing test case

* removed extra parameter

* syntax changes

* Env variable MAUTIC_PROJECT_VERSION introduced

* TypeError : str_starts_with() fixed

* fix same for merged filter too

* change variable names

* fixed failing test

* fix not beetween issue

* skip for 4.4

* skip for 4.4 csfix

* skip for 4.4 csfix

* skip for 4.4 csfix

* 7.4 syntax

* stan fix

* stan fix

* stan fix

* fixes phpstan

* skip phpstan

* removing ingnore comment

* removing unnecessary array filter

* Hide the new operators from campaign condition, leave them for segment fitlers

* Fixing operators also for int field types

* cast string

* test

* MAUT-11616 : Fix operators do not refresh after selecting a different type of field in campaign event (#356)

* fix Operators do not refresh after selecting a different type of field

* csfix

* adding test which verify the data-operators attr is available

* fix phpstan

* fix tests

* suggessions

* MAUT-11617 : Campaign -> Condition -> Custom Object Field values : Date picker unavailable for Date type fields (#357)

* fix Operators do not refresh after selecting a different type of field

* csfix

* adding test which verify the data-operators attr is available

* fix phpstan

* fix tests

* datepicker for date and datetime fields

* using const type for fieldType

Co-authored-by: Miroslav Fedeleš <[email protected]>

* suggessions

* ifx value should not be empty after change operator

---------

Co-authored-by: Miroslav Fedeleš <[email protected]>

* Replaced logger with monolog.logger.mautic (#355)

* MAUT-11515 : Custom object date segment filters should have have same operators than date custom field filters (#358)

* added all date/datetime filters to custom oject date fields

* check if getcontext is exist

* Added new function instead changing old one

* change if condition sequence

* increase code coverage

* skip test case if mrunning on mautic 4.4

* Maut 11460: Dynamic content in email builder filtered on custom object values (#352)

* on replacement

* fix test

* test

* test

* test

* fix

* skiped for 4.4

* WIP

* refining

* test case

* test refine

* fix test case

* fix test case

* split lines

* CR

* unnecessary query remove

* check isset

* local cache

* key with id

* test cases

* Update EventListener/TokenSubscriber.php

Co-authored-by: John Linhart <[email protected]>

* Update EventListener/TokenSubscriber.php

Co-authored-by: John Linhart <[email protected]>

* WIP

* string concat

* match logic for CO

* test case

* test case csfix

* test case csfix

* const

* var in config

* fix null case for datetime

* cs fix

* fix for select and multi select

* for noraml lead field

* test case

* split line

* test case

* fix for like and select

---------

Co-authored-by: Avikarsha Saha <[email protected]>
Co-authored-by: John Linhart <[email protected]>

* Update Entity/CustomFieldOption.php

Co-authored-by: GuzmanBellon <[email protected]>

* Fix EventDispatcher calling

* Fix deprecated fetchColumn call

* Use appropriate service to run a command in the test

* Add #[AllowDynamicProperties] attribute to allow using dynamic properies

* Fix tests of controllers

* Fix test of controllers

* Fix controller tests

* Fix controller tests

* Fix model tests

* Fix listener tests

* Fix Form tests

* Fix controller tests

* Fix repository tests

* Fix functional tests

* Fix functional tests

* Add a required field to fixtures

* Fix created objects for testing

* Fix pagination

* Remove commented code

* MAUT-11383 : incorrect date value being calculating when the segment filter value is "yesterday" and operator is "gt" for date field (#359)

* Fix custom parameter date issue

* add more test case

* Fix config after merging

* Fix a variable name

* Fix tests after merging

* Update dependencies

* Get the export directory using the config

* CS fixing

* Remove unnesessary constant definition

* Fix tests

* Use master request instead of deprecated

* Change phpunit configuration

* CS fixing

* PHPstan fixes

* PHPStan fixes some ORM deprecations

* Add phpstan baseline

* Fix rector issues

* Update phpstan baseline

* Fix rector issues

* Fix tests after fixing rector failures

* Fix rector failures

* Temporary set a parameter to allow the pipeline to continue even if Rector fails

* Remove the CI Rector's temporary setting

* Fix rector issues

* Add a CI setting to crate a writable directory

---------

Co-authored-by: Don Gilbert <[email protected]>
Co-authored-by: Donald Gilbert <[email protected]>
Co-authored-by: Tejas Navghane <[email protected]>
Co-authored-by: Rohit Pavaskar <[email protected]>
Co-authored-by: rahuld-dev <[email protected]>
Co-authored-by: Saurabh Gupta <[email protected]>
Co-authored-by: Saurabh Gupta <[email protected]>
Co-authored-by: Rahul Dhande <[email protected]>
Co-authored-by: Himanshu Prajapati <[email protected]>
Co-authored-by: John Linhart <[email protected]>
Co-authored-by: John Linhart <[email protected]>
Co-authored-by: aadarshjain-dev <[email protected]>
Co-authored-by: fedys <[email protected]>
Co-authored-by: Avikarsha Saha <[email protected]>
Co-authored-by: Avikarsha Saha <[email protected]>
Co-authored-by: Aarohi Prasad <[email protected]>
Co-authored-by: GuzmanBellon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants