Skip to content
Snippets Groups Projects
Commit 392d6429 authored by Jared Hancock's avatar Jared Hancock
Browse files

draft: Fix creation of client drafts

parent d71182f6
Branches
Tags
No related merge requests found
...@@ -7,7 +7,7 @@ require_once(INCLUDE_DIR.'class.draft.php'); ...@@ -7,7 +7,7 @@ require_once(INCLUDE_DIR.'class.draft.php');
class DraftAjaxAPI extends AjaxController { class DraftAjaxAPI extends AjaxController {
function _createDraft($vars) { function _createDraft($vars) {
if (!($vars['body'] = self::_findDraftBody($_POST))) if (false === ($vars['body'] = self::_findDraftBody($_POST)))
return JsonDataEncoder::encode(array( return JsonDataEncoder::encode(array(
'error' => __("Draft body not found in request"), 'error' => __("Draft body not found in request"),
'code' => 422, 'code' => 422,
...@@ -34,7 +34,7 @@ class DraftAjaxAPI extends AjaxController { ...@@ -34,7 +34,7 @@ class DraftAjaxAPI extends AjaxController {
} }
function _updateDraft($draft) { function _updateDraft($draft) {
if (!($body = self::_findDraftBody($_POST))) if (false === ($body = self::_findDraftBody($_POST)))
return JsonDataEncoder::encode(array( return JsonDataEncoder::encode(array(
'error' => array( 'error' => array(
'message' => "Draft body not found in request", 'message' => "Draft body not found in request",
...@@ -127,8 +127,7 @@ class DraftAjaxAPI extends AjaxController { ...@@ -127,8 +127,7 @@ class DraftAjaxAPI extends AjaxController {
'namespace' => $namespace, 'namespace' => $namespace,
); );
$info = self::_createDraft($vars); return self::_createDraft($vars);
$info['draft_id'] = $namespace;
} }
function getDraftClient($namespace) { function getDraftClient($namespace) {
...@@ -320,6 +319,8 @@ class DraftAjaxAPI extends AjaxController { ...@@ -320,6 +319,8 @@ class DraftAjaxAPI extends AjaxController {
return urldecode($vars[$field]); return urldecode($vars[$field]);
} }
} }
return false;
} }
} }
......
...@@ -86,7 +86,7 @@ RedactorPlugins.draft = { ...@@ -86,7 +86,7 @@ RedactorPlugins.draft = {
// No change yet — dont't show the button // No change yet — dont't show the button
return; return;
} }
if (data) { if (data && this.get()) {
this.$draft_saved.show().delay(5000).fadeOut(); this.$draft_saved.show().delay(5000).fadeOut();
} }
// Show the button if there is a draft to delete // Show the button if there is a draft to delete
...@@ -126,6 +126,7 @@ RedactorPlugins.draft = { ...@@ -126,6 +126,7 @@ RedactorPlugins.draft = {
self.set(self.opts.draftOriginal || '', false, false); self.set(self.opts.draftOriginal || '', false, false);
self.opts.autosave = self.opts.autoCreateUrl; self.opts.autosave = self.opts.autoCreateUrl;
self.draftDeleteButton.hide(); self.draftDeleteButton.hide();
self.firstSave = false;
} }
}); });
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment