Commit Graph

145 Commits

Author SHA1 Message Date
Jan Jakes
f5cc42d2e3 Trigger "mailpoet_segment_subscribed" hook when globally subscribed via admin
[MAILPOET-5992]
2024-04-22 10:16:19 +02:00
Jan Lysý
423ce62100 Add lastSubscribedAt to the subscribers API response
[MAILPOET-5894]
2024-03-22 11:09:42 +01:00
Mike Jolley
435f638011 Apply rules on lib dir 2024-03-21 16:57:59 +01:00
alex-mpoet
15b0846f34 Leave on-save email validation only in SubscriberSaveController
[MAILPOET-5878]
2024-03-15 15:29:36 +01:00
Jan Jakes
51a14a45d3 Use refreshAll() for updates, refresh subscribers/subscriber custom fields conditionally
[MAILPOET-5752]
2024-02-12 15:33:28 +01:00
alex-mpoet
014b8249bb Replace entityManager->clear with a helper, add cleanup to WP user sync
[MAILPOET-5752]
2024-02-12 15:33:28 +01:00
Rodrigo Primo
f0434d74e7 Ensure Doctrine entity cache is cleared after changing the database
ImportExportRepository::updateMultiple() changes subscribers by running
MySQL queries directly. Now that \MailPoet\Segments\WP uses Doctrine as
well this was causing a bug caught by our integration tests.

```
MailPoet\Subscribers\ImportExport\Import\ImportTest::testItSynchronizesWpUsers
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'mary'
+'Mary'

/wp-core/wp-content/plugins/mailpoet/tests/integration/Subscribers/ImportExport/Import/ImportTest.php:719
```

https://app.circleci.com/pipelines/github/mailpoet/mailpoet/16386/workflows/c3fa0cf4-a77d-41ab-a5cc-78d4b37d9228/jobs/278066/tests#failed-test-0

This test was failing because the Doctrine entities were not updated
after the import process ran and modified the subscribers directly in
the database. Running EntityManager::clear() after importing the
subscribers, forces Doctrine to query the database again to update the
entities and prevents this bug.

[MAILPOET-5752]
2024-02-12 15:33:28 +01:00
Rodrigo Primo
6f98634b94 Replace Subscriber and SubscriberSegment models with Doctrine in \MailPoet\Segments\WP
[MAILPOET-5752]
2024-02-12 15:33:28 +01:00
Rodrigo Primo
374fbe6867 Replace Segment model with Doctrine in \MailPoet\Segments\WP
[MAILPOET-5752]
2024-02-12 15:33:28 +01:00
alex-mpoet
5824905f18 Independently update existing subscribers info and status in import
[MAILPOET-5617]
2024-02-05 12:54:02 +01:00
Jan Lysý
525c80bac4 Fix PHPStan warnings in lib
[MAILPOET-5751]
2023-12-13 11:48:14 +01:00
David Remer
a1e59d5f31 Fix bug: Ensure data['tags'] is normalized
[MAILPOET-5515]
2023-10-09 10:06:56 +02:00
David Remer
f963332506 Fire mailpoet_subscriber_tag_removed after repository flush
[MAILPOET-5515]
2023-10-09 10:06:56 +02:00
David Remer
c93b433b93 Fire mailpoet_subscriber_tag_added hook after flush()
[MAILPOET-5515]
2023-10-09 10:06:56 +02:00
David Remer
47fea46dc4 Add tag added and removed actions
[MAILPOET-5515]
2023-10-09 10:06:56 +02:00
Jan Jakes
e2cf884b98 Add missing ContainerWrapper return type, fix reported errors
[MAILPOET-5569]
2023-09-20 02:36:40 -07:00
David Remer
84faac8257 Apply revenue_status in subscriber stats
[MAILPOET-5485]
2023-09-11 12:14:33 +02:00
David Remer
974559876b Add comments
[MAILPOET-5555]
2023-09-06 14:45:45 +02:00
David Remer
79999f53c3 Fix formatting
[MAILPOET-5555]
2023-09-06 14:45:45 +02:00
David Remer
ce4f19bd77 Do not resubscribe subscribers unnecessarily
[MAILPOET-5555]
2023-09-06 14:45:45 +02:00
David Remer
8170391731 Add primary key to inactive_task_ids and inactive_subscriber_ids table
[MAILPOET-4401]
2023-09-04 14:22:16 +02:00
John Oleksowicz
2987c61d77 Filter click stats by newsletter send time
MAILPOET-5508
2023-08-31 13:17:34 +02:00
John Oleksowicz
3b407d7060 Base open stats on emails sent in the same period
MAILPOET-5508
2023-08-31 13:17:34 +02:00
John Oleksowicz
06df45bb55 Refactor subscriber stats to accept startTime param
MAILPOET-5508
2023-08-31 13:17:34 +02:00
David Remer
76c299c3d7 Remove global count methods.
In the previous commit, we removed the global count for our output. This commit removes
the logic as the only places where it was used was in recalculating the cache and since
the last commit, we do not use this value anymore

[MAILPOET-4487]
2023-08-18 13:35:13 +02:00
David Remer
6dd0c844ca Take also list specific status into account when counting subscribers
[MAILPOET-4487]
2023-08-18 13:35:13 +02:00
David Remer
ec987b133d Categorize (un)subscribed users of a list correctly
To evaluate whether a user is subscribed to a list or unsubscribed you need to take into account
the status of the current subscription and not only the global status. To be unsubscribed you are
either globally or per list unsubscribed. To be subscribed you need to be globally and per list
subscribed

[MAILPOET-4487]
2023-08-18 13:35:13 +02:00
John Oleksowicz
327f78b902 Remove unused and unhelpful return value
MAILPOET-5410
2023-08-11 16:39:57 +02:00
John Oleksowicz
f0f24552f0 Update woo revenue stats to only look at past year
MAILPOET-5410
2023-08-11 16:39:57 +02:00
John Oleksowicz
62ac4d5e27 Make stats consistent with engagement score
This makes SubscriberStatisticsRepository the source of truth for
engagement score data instead of having separate queries.

As part of this change, we will now only be displaying the last year's
worth of data when viewing a report for an individual subscriber.

It also updates engagement score calculation to only count human opens,
not machine opens.

MAILPOET-5410
2023-08-11 16:39:57 +02:00
John Oleksowicz
3ec4505445 Add bulk update engagement score updated at method
MAILPOET-5410
2023-08-11 16:39:57 +02:00
Jan Lysý
577a82ca49 Add bulk action for removing tag from subscribers
[MAILPOET-5454]
2023-07-13 13:12:56 +02:00
Jan Lysý
aa12fd57d7 Add bulk action for tagging subscribers
[MAILPOET-5454]
2023-07-13 13:12:56 +02:00
John Oleksowicz
64a92c259d Add clarifying comment
MAILPOET-5404
2023-07-12 15:48:03 +02:00
John Oleksowicz
fc410c2154 Make sure lastProcessedSubscriberId is always correct
MAILPOET-5404
2023-07-12 15:48:03 +02:00
John Oleksowicz
25cbba1246 Use order by id for query
MAILPOET-5404
2023-07-12 15:48:03 +02:00
John Oleksowicz
73eae47a39 Add cron worker for backfilling engagement data
MAILPOET-5404
2023-07-12 15:48:03 +02:00
John Oleksowicz
8bf3eddf09 Return cached item for homepage stats
MAILPOET-5439
2023-07-10 11:04:33 +02:00
John Oleksowicz
b22217420f Track last sending at
MAILPOET-4998
2023-06-22 15:29:22 +02:00
John Oleksowicz
0e9b96d0b7 Track opens, clicks, purchases, and page views
MAILPOET-4998
2023-06-22 15:29:22 +02:00
Pavel Dohnal
798bc320ed Make sure the doctrine parameters are unique
Previously there was a mismatch between parameters coming from the
dynamic segment and the parameters coming from the export
controller.

[MAILPOET-5382]
2023-06-16 17:00:33 +02:00
Rodrigo Primo
0d3293be52 Remove Subscribers\Source::setSource()
I found this method in the context of a ticket to refactor Paris code to
Doctrine. As far as I can tell, it is not used anymore and it is
safe to delete it.

It was added in 1af5802 and was used only inside
Models\Subscriber::subscribe(). Then subscribe() was moved to
Subscriber\SubscriberActions in 7528f0f. Finally, commit 7db2384
refactored SubscriberActions removing the only two calls to
Source::setSource().

The test class SourceTest is removed as well as its only purpose was to
test Source::setSource().

[MAILPOET-5345]
2023-06-01 12:06:14 +02:00
alex-mailpoet
5203eb5268 Don't cache if subscribers count is below minimum value
[MAILPOET-5180]
2023-05-22 14:13:05 +02:00
alex-mailpoet
4cd1667146 Cache homepage subscribers stats
[MAILPOET-5180]
2023-05-22 14:13:05 +02:00
Rodrigo Primo
00d021109c Move ModelValidator::validateNonRoleEmail() to a new Validator class
We want to remove/refactor the whole ModelValidator class as part of the
Doctrine refactor.

This commit moves the method ModelValidator::validateNonRoleEmail() to a
new Validator class as the method is not used by the validator system of
the Paris models. ModelValidator::validateEmail() was also moved as it
is called by ModelValidator::validateNonRoleEmail().

[MAILPOET-4343]
2023-05-17 12:37:22 +02:00
Rodrigo Primo
d760272678 Remove ModelValidator::validateIPAddress()
We want to remove/refactor the whole ModelValidator class as part of the
Doctrine refactor. As a first step, this commit removes the method
ModelValidator::validateIPAddress(). It was unused in a single place and
it was replaced with a direct call to the builtin PHP way to validate an
IP address.

[MAILPOET-4343]
2023-05-17 12:37:22 +02:00
Jan Lysý
150042f670 Disable overriding custom fields on repeated subscribing
[MAILPOET-5246]
2023-05-03 11:31:24 +02:00
Jan Lysý
41abed3b15 Add custom field to subscriber's relation when it is created
[MAILPOET-5246]
2023-05-03 11:31:24 +02:00
Rodrigo Primo
5a85390655 Replace remaining calls to utf8_encode() with mb_convert_encoding()
In the previous commit, I removed all calls to the deprecated
utf8_encode() that seemed safe to remove. In this commit, I'm replacing
the calls to this function that I'm not sure if are same to remove or
not with mb_convert_encoding().

mb_convert_encoding() requires the extension mbstring to be enabled. It
should be enabled on most PHP install but not all. We are already using
mbstring functions in our code base and we provide a polyfill for PHP
installs where the extension is not enabled
(62bb75ed91/mailpoet/prefixer/composer.json (L25)).
So it should be safe to use it.

[MAILPOET-4865]
2023-04-28 10:26:03 +02:00
Brezo Cordero
2b83c8c69f Fix previously sanitized link
[MAILPOET-5254]
2023-04-21 11:14:25 +02:00