Commit 00b5f3b1 authored by Guy Thouret's avatar Guy Thouret

(fix) Save the correct published state for a blog after editing a draft - #612

No related merge requests found
Pipeline #70495569 running with stages
......@@ -221,7 +221,8 @@ class blog implements Interfaces\Api
}
if (isset($_POST['published'])) {
$blog->setPublished(!!$_POST['published']);
$published = is_string($_POST['published']) ? json_decode($_POST['published']) : $_POST['published'];
$blog->setPublished($published);
}
if (isset($_POST['monetized'])) {
......@@ -240,8 +241,7 @@ class blog implements Interfaces\Api
}
}
/* Draft post overrides access_id to Unlisted and saves target accessId to draftAccessId */
if (!$_POST['published'] || $_POST['published'] === 'false') {
if (!$blog->isPublished()) {
$blog->setAccessId(Access::UNLISTED);
$blog->setDraftAccessId($_POST['access_id']);
} elseif ($blog->getTimePublished() == '') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment