Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplicated update core tasks #163

Merged
merged 6 commits into from
Dec 9, 2024

Conversation

ilicfilip
Copy link
Collaborator

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 and completed.

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 to completed 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

  • I have tested this code to the best of my abilities.
  • I have added unit tests to verify the code works as intended.
  • I have checked that the base branch is correctly set.

Copy link
Contributor

github-actions bot commented Dec 6, 2024

Test on Playground
Test this pull request on the Playground or download the zip.

@ilicfilip ilicfilip requested a review from aristath December 6, 2024 12:55
@aristath
Copy link
Member

aristath commented Dec 9, 2024

@ilicfilip this looks good, there's just a merge conflict that needs to be resolved. After you resolve the conflict, feel free to merge the PR 👍

@ilicfilip ilicfilip merged commit d41284e into develop Dec 9, 2024
18 checks passed
@ilicfilip ilicfilip deleted the filip/fix-duplicated-update-core-tasks branch December 9, 2024 11:18
@ilicfilip ilicfilip mentioned this pull request Dec 23, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants