Mailing List Archive

[bricoleurs/bricolage] ca5f60: Fix handling of publish failures in Ajax publish r...
Branch: refs/heads/master
Home: https://github.com/bricoleurs/bricolage

Commit: ca5f60ff338263875bfad7b467e0ab6fee730d02
https://github.com/bricoleurs/bricolage/commit/ca5f60ff338263875bfad7b467e0ab6fee730d02
Author: David E. Wheeler <david@justatheory.com>
Date: 2011-08-16 (Tue, 16 Aug 2011)

Changed paths:
M comp/media/js/lib.js
M lib/Bric/App/Callback.pm
M lib/Bric/App/Callback/Desk.pm

Log Message:
-----------
Fix handling of publish failures in Ajax publish requests.

This fixes the half of bug #277, when one attempts to publish from a desk or workspace.

When `PUBLISH_RELATED_FAIL_BEHAVIOR = fail` and a related asset fails to publish, we now call `raise_conflict` to return a 409 and do a better job displaying *all* the appropriate error messages.

When `PUBLISH_RELATED_FAIL_BEHAVIOR = warn` and related asset fails to publish, we call a new moethod, `show_accepted()`. This method returns a 202 status code, which I'm abusing a bit here, but it comes closest to what we want. The story properly publishes and disappears from the desk, but a new handler in the Ajax code also shows the errors when related failed to publish. I also added code to abort at the end of the Desk `publish` callback when a request is Ajax so that no other stuff gets sent back to the browser. This is because in "warn" mode, we wnt the full request to succeed, with no rollbacks or anything, and all subsequent code should execute, so that the story will properly be published and removed from workflow.

Tomorrow I'll have to figure out what to do about non-ajax publish requests in order to properly and finally fix bug # 277.