Fix double publish, fix publish from view page

This fixes the "double publishing" bug (where you can publish a badge two or more times by clicking the publish button real fast).

This also fixes the bug where publishing from the view page didn't work, and adds appropriate error messages if the publishing fails.