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