unicorn-fail / dreditor.org

Dreditor Browser Extension Site
https://dreditor.org
GNU General Public License v2.0
0 stars 1 forks source link

"Building..." button doesn't always return the buttons #11

Open markhalliwell opened 10 years ago

markhalliwell commented 10 years ago

Currently if a branch/tag/PR is in the state of a "build" it returns a disabled "Building..." button. The AJAX event used to "check" the build state only happens when one of us admins does a "rebuild" callback and then it auto checks if json.building value is set and then does it's "check" on a setTimeout(): https://github.com/dreditor/dreditor.org/blob/7.x/sites/all/modules/custom/dreditor_org/js/dreditor_org.js#L105-L125

So if this check isn't initiated by the rebuild callback, the button just appears to say "Building..." until one refreshes the page.

This was done very hastily and it's obviously unstable (not my best work lol).

Solution: Have a second behavior attachment that detects if there is a build button and instantiate the callback, avoiding the setTimeout entirely.