Commit Graph

3851 Commits

Author SHA1 Message Date
Brezo Cordero
a901b1caa7 Remove Subscribers IdiORM Model
[MAILPOET-3820]
2021-11-23 13:54:41 +01:00
Rostislav Wolny
6f5cde2fbf Update counts of sending queue when triggering post notification
When we trigger post notification sending we used to create post notification history record,
save all scheduled task subscribers but didn't update counts on queue.
Counts were eventually updated when sending started. This was causing some issues e.g. when sending
got stuck post notification item was showing 0/0 in sending status.
Pausing/resuming such a post notification caused that it was immediately set as sent.

This commit adds updating counts in queue immediately when sending starts.
[MAILPOET-3962]
2021-11-23 13:39:51 +01:00
Rostislav Wolny
bbb23e4f37 Update also newsletter status when completing sending task
[MAILPOET-3962]
2021-11-23 13:39:51 +01:00
Rostislav Wolny
8e5d7dd917 Unify conditions for triggering cron for subscribers stats report
Having a different condition in the worker checkRequirements was causing
that the cron was attempting to schedule the jog over and over again.
[MAILPOET-3970]
2021-11-23 12:55:01 +01:00
Rodrigo Primo
5c6000bed6 Fix: duplicated entries when exporting subscribers of dynamic segments
This commit fixes a bug in the code that exports subscribers to a CSV
file. This bug caused duplicated entries when exporting subscribers of
dynamic segments. Instead of a given subscriber appearing only once in the
CSV file, they would be included multiple times, and the number of times
would depend on the number of static segments that they had subscribed to.

This bug was caused by a problem in the code that generates the SQL
query used to fetch the subscribers that will be exported. The same
method is used for subscribers not linked to a segment, static
segments, and dynamic segments. The table wp_mailpoet_segments was
included in the query in the three cases, but it should not be included
for dynamic segments as this type of segment does not have a
corresponding entry in this table. Including this table without
specifying a segment ID (as there is not one for dynamic segments),
meant that MySQL would return an extra entry for a given subscriber for
each static segment that they had subscribed to.

[MAILPOET-3900]
2021-11-22 14:33:58 +01:00
Oluwaseun Olorunsola
21792b0a0b Refactor \MailPoet\Test\DataFactories\ScheduledTask to Doctrine
[MAILPOET-3817]
2021-11-22 13:53:13 +01:00
Rodrigo Primo
c701f02d27 Pass a copy of the Carbon object to avoid unexpected side effects
This commit changes LastSubscribedAtListener to pass a copy of the Carbon
object representing the current time to the SubscriberEntity property
lastSubscribedAt. Passing a copy instead of the object itself is needed to
avoid unexpected side effects. Before this change, modifying the time
of this property of a given SubscriberEntity instance could affect the
same field of another instance as the same object used inside
LastSubscribedAtListener for all entities.

[MAILPOET-3946]
2021-11-22 10:52:58 +01:00
Rodrigo Primo
9e334a953a Add integration tests for LastSubscribedAtListener
This commit adds basic integration tests for the class
LastSubscribedAtListener since it had none and it will be modified in a
subsequent commit. A method from TimestampListenerTest was moved to a
base class since it can be reused in LastSubscribedAtTest.

[MAILPOET-3946]
2021-11-22 10:52:58 +01:00
Rodrigo Primo
2e050d7a32 Pass a copy of the Carbon object to avoid unexpected side effects
This commit changes TimestampListener to pass a copy of the Carbon
object representing the current time to the entity properties updatedAt
and createdAt. Passing a copy instead of the object itself is needed to
avoid unexpected side effects. Before this change, modifying the time
of the createdAt or updatedAt field of a given entity could affect the
same field of another entity as it could be the same object used inside
TimestampListener for all entities.

[MAILPOET-3870]
2021-11-22 09:58:49 +01:00
Rodrigo Primo
12e326596d Remove unused imported classes from TimestampListenerTest
Found this while working on [MAILPOET-3870]
2021-11-22 09:58:49 +01:00
Pavel Dohnal
5599cfffae Remove old models usage from ReceivePostNotification test
[MAILPOET-3823]
2021-11-22 09:31:03 +01:00
Oluwaseun Olorunsola
d630419982 Fixed fixed types error
[MAILPOET-1950]
2021-11-17 15:37:13 +01:00
Oluwaseun Olorunsola
d256d2a235 Fixed acceptance test errors
[MAILPOET-1950]
2021-11-17 15:37:13 +01:00
Oluwaseun Olorunsola
31448d6136 Fixing acceptance test errors
[MAILPOET-1950]
2021-11-17 15:37:13 +01:00
Rostislav Wolny
325173286e Fix stats reports checks in cron worker trigger
[MAILPOET-3948]
2021-11-17 10:15:28 +01:00
Brezo Cordero
3cf95c7feb Attempt to convert dates using d/m/Y
[MAILPOET-3747]
2021-11-16 11:06:52 +01:00
Brezo Cordero
c95557a0ec Remove mixed from test
[MAILPOET-3945]
2021-11-16 09:14:41 +01:00
Jan Lysý
7d04ea28ad Add meta to response when email is unauthorized
[MAILPOET-3881]
2021-11-15 15:03:43 +01:00
Pavel Dohnal
9069b680b9 Fix acceptance test
[MAILPOET-3926]
2021-11-15 14:54:06 +01:00
Rodrigo Primo
ea3b38bc08 Deprecate \MailPoet\Models\NewsletterLink
[MAILPOET-3816]
2021-11-15 13:03:47 +01:00
Rodrigo Primo
5094176ce9 Replace NewsletterLink with NewsletterLinkEntity in the class WorkerTest
[MAILPOET-3816]
2021-11-15 13:03:47 +01:00
Rodrigo Primo
75da3dca45 Replace NewsletterLink with NewsletterLinkEntity in the class TrackTest
[MAILPOET-3816]
2021-11-15 13:03:47 +01:00
Rodrigo Primo
d1b13dbd70 Replace NewsletterLink with NewsletterLinkEntity in the class NewsletterTest
[MAILPOET-3816]
2021-11-15 13:03:47 +01:00
Rodrigo Primo
b5ac7dd507 Replace NewsletterLink with NewsletterLinkEntity in the class SendingQueueTest
[MAILPOET-3816]
2021-11-15 13:03:47 +01:00
Rodrigo Primo
511556549b Replace NewsletterLink with NewsletterLinkEntity in the class WooCommercePastRevenues
[MAILPOET-3816]
2021-11-15 13:03:47 +01:00
Rodrigo Primo
0c8a8d8caa Replace NewsletterLink with NewsletterLinkEntity in the class LinksTest
[MAILPOET-3816]
2021-11-15 13:03:47 +01:00
Rodrigo Primo
d9296d86fd Replace NewsletterLink with NewsletterLinkEntity in the class Links
It was also necessary to update two NewsletterTest tests, as after the
change to Links::save(), having a queue ID set became mandatory (before
it was not and one was not set properly in the mock SendingQueue object).

[MAILPOET-3816]
2021-11-15 13:03:47 +01:00
Rodrigo Primo
c870c416ad Replace NewsletterLink with NewsletterLinkEntity in the class LinksTest
[MAILPOET-3816]
2021-11-15 13:03:47 +01:00
Rodrigo Primo
612eb1073d Move NewstetterLink properties to NewsletterLinkEntity
Doing this as part of the task to deprecated old Paris models
(NewsletterLink) and use Doctrine entities instead
(NewslleterLinkEntity).

[MAILPOET-3816]
2021-11-15 13:03:47 +01:00
Pavel Dohnal
09719ca450 Use a better function for instance test
[MAILPOET-3876]
2021-11-10 12:49:48 +01:00
Pavel Dohnal
9229ed77d8 Refactor to doctrine
[MAILPOET-3876]
2021-11-10 12:49:48 +01:00
Pavel Dohnal
f5614ed2bd Refactor test to doctrine
[MAILPOET-3876]
2021-11-10 12:49:48 +01:00
Oluwaseun Olorunsola
274abc09fc Fixed failing test and default select uncheck not saving
[MAILPOET-3894]
2021-11-10 09:42:15 +01:00
Rostislav Wolny
dd0a19a314 Add BC for importing older exported templates
We allow exporting templates as JSON and templates exported from the older plugin versions use thumbnail key for storing the image data.
[MAILPOET-2686]
2021-11-08 13:24:53 +01:00
Rostislav Wolny
b10bb31321 Add cron job for generating/re-generating template thumbnail files
[MAILPOET-2686]
2021-11-08 13:24:53 +01:00
Rostislav Wolny
58bcca67ed Allow saving only base64 encoded jpeg
The tool that we use on the frontend generates jpegs. This check adds a protection against saving different type of data.
[MAILPOET-2686]
2021-11-08 13:24:53 +01:00
Rostislav Wolny
6cfcf4b5b5 Add image compression when saving the newsletter template image
[MAILPOET-2686]
2021-11-08 13:24:53 +01:00
Rostislav Wolny
aed122f4a2 Update domain of the thumbnail in case the site domain changed
This handle cases when admin changes the site URL.
[MAILPOET-2686]
2021-11-08 13:24:53 +01:00
Rostislav Wolny
7fc55cf41c Fix namespace in NewsletterTemplatesRepository test
[MAILPOET-2686]
2021-11-08 13:24:53 +01:00
Rostislav Wolny
2bb74c6302 Add service for saving templates base64 data to image files
[MAILPOET-2686]
2021-11-08 13:24:53 +01:00
Rostislav Wolny
b51f7b2d0e Save new templates image data to the new columns
[MAILPOET-2686]
2021-11-08 13:24:53 +01:00
wxa
57f4468efc Fix 'Enable auto-updates' link missing when Premium is up-to-date
[MAILPOET-3921]
2021-11-08 11:40:53 +01:00
Rostislav Wolny
4a76827a77 Fix fetching count of segments with multiple filters
We needed to get number of rows which meet the condition.
I couldn't use DQL since it doesn't allow a subquery in FROM
so I rewrote the query using DBAL level query builder.
[MAILPOET-3922]
2021-11-08 11:34:56 +01:00
oluwaseun Olorunsola
7dea96cb90 Restore deleted UnitTester.php file due to lint check failing on Circleci
We discovered that Codeception will regenerate the file during unit testing. Unfortunately, the regenerated file fails lint check which prevents the build from passing on Circleci

We restored the file and left it empty

[MAILPOET-3822]
2021-11-08 11:26:23 +01:00
oluwaseun Olorunsola
1db12e5ce2 Deleted UnitTester.php file due to it not been used
[MAILPOET-3822]
2021-11-08 11:26:23 +01:00
oluwaseun Olorunsola
d5c510cd08 Remove the method \UnitTester::generateSubscribers
[MAILPOET-3822]
2021-11-08 11:26:23 +01:00
Brezo Cordero
9da404477b Improve file path on test
[MAILPOET-3660]
2021-11-08 11:12:10 +01:00
Brezo Cordero
79021fcd19 Check types on test
[MAILPOET-3660]
2021-11-08 11:12:10 +01:00
Brezo Cordero
534b8f085d Do not replace quotes with Unicode in ALC titles
[MAILPOET-3660]
2021-11-08 11:12:10 +01:00
Pavel Dohnal
b30a8de9ca Fix default confirmation message missing in new forms
[MAILPOET-3853]
2021-11-08 09:58:06 +01:00