Commit Graph

177 Commits

Author SHA1 Message Date
Mustapha Hadid
df171fdcc7 Add JSON endpoint for CAPTCHA rendering
To be used inside WP/WC registration form to construct URL for CAPTCHA page.

[MAILPOET-6325]
2024-12-17 13:56:00 +02:00
Mustapha Hadid
3bda992f13 Move CAPTCHA classes under MailPoet\Captcha dir
CAPTCHA usage is no longer tied to MP's subscription form.
2024-12-17 13:56:00 +02:00
Rostislav Wolny
d6d71c7cc3 Ensure the API request data are string
In case an array was passed to an endpoint or token, there was a fatal error.
[MAILPOET-6348]
2024-12-09 15:08:00 +01:00
Rostislav Wolny
55f2d83abb Prevent resending emails in case the email is not active
Automation email needs to be active in order to be sent.
If we allow resending to inactive emails, we would need to activate them first,
but this could be an unexpected side effect. And activating may cause sending other paused tasks as a side effect.
I expect the email to be active in the majority of cases, so users should not meet this notice very often.
[MAILPOET-6241]
2024-12-09 13:31:49 +01:00
Rostislav Wolny
79de8cc17c Set proper status when resending activable newsletter type
[MAILPOET-6241]
2024-12-09 13:31:49 +01:00
Rostislav Wolny
e6abec74d4 Refactor SubscriberFinder::addSubscribersToTaskFromSegments to return void
We removed the return value to prevent us from using it to check if there were recipients.
It is not 100% reliable for that purpose because it returns 0 for a repeated call.
[MAILPOET-6346]
2024-12-02 11:45:10 +01:00
Rostislav Wolny
3fbff8c83f Optimize newsletter reactivation
When reactivating a newsletter with many queues (e.g., a welcome email with a long history)
NewsletterEntity::getQueues may fail because it attempts to fetch all queues and instantiate
many entity objects.

In this commit, I optimize this by looking only into unfinished queues.
getUnfinishedQueues look for where countToProcess is higher than 0.
We set the count for welcome emails when we create a new queue
see f1ffc77bf3/mailpoet/lib/Newsletter/Scheduler/WelcomeScheduler.php (L140)
[MAILPOET-6310]
2024-11-11 12:21:22 +01:00
Oluwaseun Olorunsola
6ea5074649 Move WP translation function from __construct
According to this post https://make.wordpress.org/core/2024/10/21/i18n-improvements-6-7/, we are currently doing_it_wrong

MAILPOET-6298
2024-10-31 15:54:28 +02:00
Pavel Dohnal
55f21e8cd7 Fix inactive notifications clog sending queue
[MAILPOET-6259]
2024-10-28 11:09:57 +01:00
Rostislav Wolny
3e27192f83 Move fix for missing confirmation email hash to migrations
[MAILPOET-6273]
2024-10-21 11:25:13 +02:00
Pavel Dohnal
3d2ad79931 Ensure the newsletter has hash before preview
[MAILPOET-6273]
2024-10-21 11:25:13 +02:00
Mustapha Hadid
8f95229288 Remove no longer used class parameter 2024-10-14 13:30:16 +02:00
Mustapha Hadid
73e8ad717d Use controller over service to get authorized emails
A preliminary step to enable caching authorized emails data from the API
2024-10-14 13:30:16 +02:00
Jan Jakes
f483d40c19 Clean settings cache when reinstalling the plugin 2024-09-13 10:34:55 +02:00
Rostislav Wolny
f3d6813d97 Load data inconsistencies async from API
[MAILPOET-6219]
2024-09-11 15:19:35 +02:00
Rostislav Wolny
33f4b2d729 Replace usage of WP's current_time without gmt parameter in libs
This commit replaces usages by Carbon::now or in case we need a timestamp it
keeps current_time but adds the gtm parameter as true.
[MAILPOET-6142]
2024-08-19 15:29:42 +02:00
Jan Jakes
0584c63180 Replace old model table name constants with Doctrine repositories
[MAILPOET-6142]
2024-08-19 15:29:42 +02:00
Rostislav Wolny
f022cc23fc Allow pingBridge endpoint for all users with access to the plugin admin
We call the endpoint on the admin pages and the restricted access was causing
that editor users were getting false error notices.
[MAILPOET-6189]
2024-08-14 11:54:28 +03:00
Rostislav Wolny
cb5f533e54 Add API for fixing inconsistent data
[MAILPOET-1587]
2024-08-08 15:37:32 +02:00
Pavel Dohnal
dec9a02ca4 Replace join query with a simple query
[MAILPOET-6148]
2024-07-19 15:03:35 +02:00
 Ján Mikláš
4af5720741 Refactor help endpoint
[MAILPOET-5755]
2024-07-04 08:04:34 +02:00
 Ján Mikláš
5253d79e81 Use types in new class properties
[MAILPOET-5755]
2024-07-04 08:04:34 +02:00
 Ján Mikláš
5847918409 Return 400 instead of 404 in Help API
[MAILPOET-5755]
2024-07-04 08:04:34 +02:00
 Ján Mikláš
88c0836443 Create endpoints to cancel and reschedule tasks
[MAILPOET-5755]
2024-07-04 08:04:34 +02:00
alex-mpoet
a6caf0a1e6 Add bridge ping endpoint
[MAILPOET-6030]
2024-06-12 11:16:51 +02:00
alex-mpoet
c59ae2d82c Add cron pinging endpoint
[MAILPOET-6029]
2024-06-10 17:07:31 +02:00
Oluwaseun Olorunsola
070fd30b6e Update the notice message to fix consistency
MAILPOET-6022
2024-06-07 17:17:57 +02:00
Oluwaseun Olorunsola
4f63437ccc Add html to the error message
MAILPOET-6022
2024-06-07 17:17:57 +02:00
Oluwaseun Olorunsola
95e595de42 Invalid API endpoint exception improvement
MAILPOET-6022
2024-06-07 17:17:57 +02:00
John Oleksowicz
6675a616b5 Display proper notices for segment actions
This updates some of the segment listing messages to include the name of
 the segment to avoid confusion, and allows for the possibility that
 bulk actions will work for some segments but not all, in which case we
 need to show both success and error messages.

MAILPOET-5395
2024-04-24 12:59:37 +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
Jan Lysý
60bf440bff Add check that updatedAt is set
[MAILPOET-5860]
2024-03-18 08:55:44 -05:00
Jan Jakes
4b3744717f Revert "Unify responses of newsletter editing API methods with get()"
This reverts commit e0b6cf7b41.

In the next commit, I will add a different fix for this issue.

[MAILPOET-5833]
2024-02-05 13:28:15 +01:00
Jan Jakes
d6da2af55b Extract newsletter bulk delete logic to a controller
Repositories shouldn't inject other repositories. Also, this solves circular DI dependency.

[MAILPOET-5845]
2024-02-02 12:48:40 +01:00
Rodrigo Primo
0409747216 Remove outdated code comment
This class doesn't use MailPoet\Tasks\Sending anymore.

[MAILPOET-5684]
2024-01-31 12:21:54 +01:00
Rodrigo Primo
19b33e15f5 Refactor SendingQueue::add() to use Doctrine instead of Tasks\Sending
[MAILPOET-5684]
2024-01-31 12:21:54 +01:00
Brezo Cordero
ab23a01423 Modify the check for sender address
to implement rule for existing campaigns.

[MAILPOET-5832]
2024-01-20 13:39:23 +05:00
Jan Jakes
e0b6cf7b41 Unify responses of newsletter editing API methods with get()
[MAILPOET-5779]
2024-01-16 18:15:35 +01:00
Brezo Cordero
1162b5aca1 Verify sender Address on newsletter activation
[MAILPOET-5786]
2024-01-15 19:34:21 +05:00
Brezo Cordero
5735d21e4d Remove isDomainDmarcRestricted
[MAILPOET-5782]
2024-01-14 19:37:36 +05:00
Rostislav Wolny
1565151179 Show the campaign name alongside the subject in standard emails listing
[MAILPOET-5646]
2024-01-08 12:04:06 +05:00
Oluwaseun Olorunsola
b3665fd1bc Replace ReactStringReplace with createInterpolateElement
MAILPOET-5162
2023-11-02 17:09:49 +01:00
Oluwaseun Olorunsola
4dba4f8b6a Add KB link to the error message "Your MSS key is already used on another site"
MAILPOET-5162
2023-11-02 17:09:49 +01:00
Rodrigo Primo
d4a80c7230 Move SendingQueueEntity::toArray() to SendingQueuesResponseBuilder::build()
Based on a suggestion during the review of the PR, it was decided that
it makes more sense for the code that was created as
SendingQueueEntity::toArray() tp be moved to
SendingQueuesResponseBuilder::build(). It is used only to build the
format that is send in the API response.

[MAILPOET-4368]
2023-10-25 21:09:39 +02:00
Rodrigo Primo
508fdd7756 Refresh Doctrine entities in SendingQueue::add() to avoid issues
Since SendingQueue::add() still uses Paris, it was running into some
problems caught by our integration tests since some Sending methods
where refactored to Doctrine. The issue was that we started loading some
Doctrine entities earlier, then Paris code inside SendingQueue::add()
would change the same rows, causing the Doctrine entities to contain
stale data. To workaround this problem, in this commit, we are making
sure that the Doctrine entities are refreshed after they are changed by
Paris.

I considered refactoring SendingQueue::add() to use Doctrine but I
wasn't sure what to do with SendingTask::create() and
SendingTask::createFromQueue() so I decided to take a different
approach.

[MAILPOET-4368]
2023-10-25 21:09:39 +02:00
Rodrigo Primo
dc1cee5118 Replace Newsletter model with NewsletterEntity in SendingQueue
This was the easiest way to fix failing integration tests related to
updating some Sending methods to use Doctrine instead of Paris. Using
Paris in SendingQueue to update the database was creating a state where
Doctrine had stale data and this was causing the tests to fail.

[MAILPOET-4368]
2023-10-25 21:09:39 +02:00
John Oleksowicz
53bc5a2505 Ensure filter segments display for draft/scheduled
This is only tangentially related to this ticket. I noticed during
testing that the filter segment tag was not showing up in listings for
standard newsletters that were drafts or scheduled. This is because
options weren't included in the response for standard newsletters.

MAILPOET-5512
2023-10-16 10:22:22 +02:00
Jan Lysý
ea4f4b1003 Remove temporary fix for Newsletters
[MAILPOET-5563]
2023-10-11 11:26:22 +02:00
John Oleksowicz
a2d04e93c5 Add endpoint to retrieve count for multiple segments
MAILPOET-5510
2023-10-04 12:59:38 +02:00