aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-06-07 19:36:47 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-06-07 19:36:47 +0000
commit4f5e0a8fba1460458bd74fdfc572f0394143c1c2 (patch)
tree44e8f419bf26276a276257fd1f46a21c092b77a7 /mod
parentbcb735d83d36a51960dab4a4b65cb2d1a159db5f (diff)
downloadelgg-4f5e0a8fba1460458bd74fdfc572f0394143c1c2.tar.gz
elgg-4f5e0a8fba1460458bd74fdfc572f0394143c1c2.tar.bz2
Added metadata 'new_post' when autosaving blogs to help with river / revision logic. Autosaved blogs now correctly show up in river and don't create a revision upon initial save.
git-svn-id: http://code.elgg.org/elgg/trunk@6388 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod')
-rw-r--r--mod/blog/actions/blog/auto_save_revision.php5
-rw-r--r--mod/blog/actions/blog/save.php15
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());