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 obsolete cockpit defer API #63

Merged
merged 1 commit into from
Apr 12, 2024
Merged

Conversation

martinpitt
Copy link
Contributor

@martinpitt martinpitt commented Mar 27, 2024

done/fail/always is the long-obsolete cockpit.defer() jQuery promise API, which will be dropped eventually. Replace them with the standard Promise API.

This requires a little teak in safeDBusCall() -- while .fail() also returns the rejection, Promise.catch() handles it and returns nothing.

In InstalledProducts.handleAutoAttach(), both handlers in were doing exactly the same thing, so use finally() instead. Also use an arrow instead of a function to avoid the self = this dance.

done/fail/always is the long-obsolete `cockpit.defer()` jQuery promise
API, which will be dropped eventually. Replace them with the standard
`Promise` API.

This requires a little teak in safeDBusCall() -- while `.fail()` also
returns the rejection, `Promise.catch()` handles it and returns nothing.

In `InstalledProducts.handleAutoAttach()`, both handlers in were doing
exactly the same thing, so use finally() instead. Also use an arrow
instead of a function to avoid the `self = this` dance.
@martinpitt martinpitt marked this pull request as ready for review March 27, 2024 08:18
@martinpitt
Copy link
Contributor Author

@ptoscano Can you please take a look? (Happy to talk you through the patch too, if you have questions). Thanks!

@ptoscano ptoscano merged commit e0dd566 into candlepin:main Apr 12, 2024
7 checks passed
@martinpitt martinpitt deleted the defer branch April 12, 2024 12:59
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