]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
now sending the new album notification after the first set of photos are uploaded
authorCash Costello <cash.costello@gmail.com>
Sun, 2 Aug 2009 22:39:00 +0000 (22:39 +0000)
committerCash Costello <cash.costello@gmail.com>
Sun, 2 Aug 2009 22:39:00 +0000 (22:39 +0000)
actions/addalbum.php
actions/upload.php
start.php

index 909f04c9fe1952848e4caa08d6c9667e238d652c..b53cf9692310e33c6f25e0ba2d38536b42ae5ec3 100644 (file)
                $album->title = $title;\r
                $album->description = $body;\r
                \r
+               // we catch the adding images to new albums in the upload action and throw a river new album event \r
+               $album->new_album = TP_NEW_ALBUM;\r
+               \r
                // Before we can set metadata, we need to save the album\r
                if (!$album->save()) {\r
                        register_error(elgg_echo("album:error"));\r
                        forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //failed, so forward to previous page\r
                }\r
                \r
-               // Now let's add tags. We can pass an array directly to the object property! Easy.\r
+               // Now let's add tags\r
                if (is_array($tagarray)) {\r
                        $album->tags = $tagarray;\r
                }\r
                \r
-               // we catch the adding images to new albums in the upload action and throw a river new album event \r
-               $album->new_album = TP_NEW_ALBUM;\r
                \r
                \r
                // Success message\r
index 6911978b052807436febaf0f411b2fab06a799b3..d5fb7d80276e602cc5ccb006139a0adc7050d198 100644 (file)
                // update user/group size for checking quota\r
                $image_repo_size += $sent_file['size'];\r
 \r
-               // successful upload so check if this is a new album and throw river event if so\r
+               // successful upload so check if this is a new album and throw river event/notification if so\r
                if ($album->new_album == TP_NEW_ALBUM) {\r
+                       $album->new_album = TP_OLD_ALBUM;\r
+\r
+                       // we throw the notification manually here so users are not told about the new album until there\r
+                       // is at least a few photos in it\r
+                       object_notifications('create', 'object', $album);\r
+                       \r
                        if (function_exists('add_to_river'))\r
                                add_to_river('river/object/album/create', 'create', $album->owner_guid, $album->guid);\r
-                       $album->new_album = TP_OLD_ALBUM;\r
                }\r
        \r
                if ($img_river_view == "all") {\r
index c44c3cfc1fcad7c8573381d671c42e4f7c0b29a2..5a225e0533a44426f78c9fe46e601381c455cbae 100644 (file)
--- a/start.php
+++ b/start.php
                $method = $params['method'];\r
                if (($entity instanceof ElggEntity) && ($entity->getSubtype() == 'album'))\r
                {\r
+                       // block notification message when the album doesn't have any photos\r
+                       if ($entity->new_album == TP_NEW_ALBUM)\r
+                               return false;\r
+                               \r
                        $descr = $entity->description;\r
                        $title = $entity->title;\r
                        $owner = $entity->getOwnerEntity();\r
-                       return sprintf(elgg_echo('album:river:created'), $owner->name) . ' ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL();\r
+                       return sprintf(elgg_echo('album:river:created'), $owner->name) . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL();\r
                }\r
                return null;\r
        }\r