When the `or Cancel` button is clicked, the action `SET_SETTING` is not
triggered and thus `hasUnsavedChanges` was not updated resulting in
problems like the one described here:
https://github.com/mailpoet/mailpoet/pull/4315#issuecomment-1273013496.
This commit fixes this problem by updating `hasUnsavedChanges` also when
the action `SET_SETTINGS` (not the `s` at the end) is triggered.
[MAILPOET-4499]
This commit improves the code that decides whether or not to display a
confirmation message when the user tries to leave the settings pages
with unsaved changes. Before this commit, the confirmation message would
be displayed even if the user changed the settings a few times and then
back to the original value. Now, this won't happen anymore.
When the page is loaded, we save the original state of data in a
different property called `originalData` and use it to compare against
the current data when deciding whether or not the page has unsaved
changes.
I considered storing just a hash of the original data and using that for
the comparison, but I couldn't find an easy way to generate a hash of an
object in JS.
[MAILPOET-4499]
This commit updates a few acceptance tests to make sure they work with
the new modal that was added when the user tries to leave the settings
page before waiting for the save process to finish.
[MAILPOET-4499]
This is necessary to set state.save.hasUnsavedChanges to false when the
user clicks on the Verify button as this call triggers a call to
SET_SETTING that sets state.save.hasUnsavedChanges to true.
[MAILPOET-4499]
This commit display a confirmation modal when the user tries to leave
the settings page and there are unsaved changes or saving is current in
progress. It uses the same React component that is used for form editor.
[MAILPOET-4499]
The previous logic could not reliably redirect to the template selection
and was showing the 'Edit newsletter' buttons to early in the process. The
logic which decides on what buttons to show have now been bundled in a
single EditNewsletter component
[MAILPOET-4520]
getNewsletterFromQueue() has too many conditions under which it returns null. Therefore we can not rely on that method when we wont to delete running tasks with no associated newsletter.
[MAILPOET-4708]
WooCommerce Subscriptions doesn't support WooCommerce Custom Orders
Tables, so we should skip the WooCommerce Subscriptions related tests
when Woo COT is enabled.
[MAILPOET-4695]
Currently, WooCommerce Subscriptions doesn't support WooCommerce Custom
Orders Table, so we want to skip all WooCommerce Subscriptions related
tests when Woo COT is enabled.
[MAILPOET-4695]
This commit changes the Codeception extension CheckSkippedTestsExtension
that we use to generate an error when tests are skipped in the `trunk` and
`release` branches. Now this extension accepts a list of tests that can
be skipped in those two branches. This will be necessary as part of the
project to support WooCommerce Custom Orders Tables as in some scenarios
we want to skip WooCommerce Subscriptions tests and in some we don't.
For now, WooCommerce Subscrptions doesn't support Woo COT, so we want to
run Woo Subscriptions tests when COT is disabled, but we want to skip
then when COT is enabled.
The main change is that now we are using the `TEST_SKIPPED` Codeception event
instead of the `SUITE_AFTER` event. This change was necessary as in the
latter event we don't have any information about the tests that were
skipped.
[MAILPOET-4695]
When no corresponding newsletter was found the task can be deleted. The behavior
before meant that such a task would remain forever in the database with the
status 'running'.
[MAILPOET-4699]
Sometimes errors overlap each other so that the 'Last Seen error' we log
does not provide sufficient information on the cause of a problem.
E.g. one worker might cause an SQL issue, which closes the EntityManager and a
subsequent worker might overwrite this error with the information that the
EntityManager is closed.
With this commit, both those issues will be logged as an error.
[MAILPOET-4699]