diff options
Diffstat (limited to 'mod/blog')
-rw-r--r-- | mod/blog/actions/blog/auto_save_revision.php | 5 | ||||
-rw-r--r-- | mod/blog/actions/blog/save.php | 15 |
2 files changed, 14 insertions, 6 deletions
diff --git a/mod/blog/actions/blog/auto_save_revision.php b/mod/blog/actions/blog/auto_save_revision.php index ce35c1295..00b24acce 100644 --- a/mod/blog/actions/blog/auto_save_revision.php +++ b/mod/blog/actions/blog/auto_save_revision.php @@ -44,6 +44,11 @@ if ($title && $description) { $blog->excerpt = elgg_make_excerpt($excerpt); // must be present or doesn't show up when metadata sorting. $blog->publish_date = time(); + + // mark this as a brand new post so we can work out the + // river / revision logic in the real save action. + $blog->new_post = TRUE; + if (!$blog->save()) { $error = elgg_echo('blog:error:cannot_save'); } diff --git a/mod/blog/actions/blog/save.php b/mod/blog/actions/blog/save.php index 138c32bda..2647e7b9a 100644 --- a/mod/blog/actions/blog/save.php +++ b/mod/blog/actions/blog/save.php @@ -31,8 +31,8 @@ if ($guid) { $success_forward_url = get_input('forward', $blog->getURL()); // save some data for revisions once we save the new edit - $revision_value = $blog->description; - $new_post = FALSE; + $revision_text = $blog->description; + $new_post = $blog->new_post; } else { $blog = new ElggBlog(); $blog->subtype = 'blog'; @@ -140,13 +140,16 @@ if (!$error) { // remove autosave draft if exists $blog->clearAnnotations('blog_auto_save'); - // if this was an edit, create a revision - if (!$new_post && $revision_value) { - // create a revision annotation - $blog->annotate('blog_revision', $revision_value); + // no longer a brand new post. + $blog->clearMetadata('new_post'); + + // if this was an edit, create a revision annotation + if (!$new_post && $revision_text) { + $blog->annotate('blog_revision', $revision_text); } system_message(elgg_echo('blog:message:saved')); + // @todo do we want to alert on updates? if ($new_post && $blog->status == 'published') { add_to_river('river/object/blog/create', 'create', get_loggedin_userid(), $blog->getGUID()); |