Fix duplicated update core tasks #163
Merged
+47
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
We had a bug reported today by @tacoverdo , after Core update confetti were triggered on every page load.
We had a bug which caused that update core task with the same ID can be added multiple times, resulting the task being at the same time marked as
pending_celebration
andcompleted
.Until now we looped through the suggested tasks
<ul>
(in the Widget), looking for the tasks which are mark as pending for celebration and marking them as completed. The problem was that also in JS we filter out completed tasks from rendering in the list, which resulted in confetti being triggered over and over.I have fixed this by preventing update-core task with the same ID to be added twice. Furthermore I moved transitioning tasks from
pending_celebration
tocompleted
on page load (in PHP), so it is no more relevant if the task is actually rendered in the list or not.Besides this I found a bug with results returned from
\wp_get_update_data
, in method used for generating tasks it was working fine but in the method for evaluating tasks it was not as it was called too early. The get_core_updates function wasnt defined, which resulted in always returning 0 for available Core updates (marking the task as completed although nothing was updated).Summary
This PR can be summarized in the following changelog entry:
Fix duplicated update core tasks
Quality assurance