]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Notice.php
Merge branch 'testing' into 0.9.x
[quix0rs-gnu-social.git] / classes / Notice.php
index dccc3685aae399c3c8b4e0b89ce40571fce35666..d65f0da9a9247a0af8df42e5cdc7460aac0b95d2 100644 (file)
@@ -148,11 +148,11 @@ class Notice extends Memcached_DataObject
         //turn each into their canonical tag
         //this is needed to remove dupes before saving e.g. #hash.tag = #hashtag
         for($i=0; $i<count($hashtags); $i++) {
+            /* elide characters we don't want in the tag */
             $hashtags[$i] = common_canonical_tag($hashtags[$i]);
         }
 
         foreach(array_unique($hashtags) as $hashtag) {
-            /* elide characters we don't want in the tag */
             $this->saveTag($hashtag);
             self::blow('profile:notice_ids_tagged:%d:%s', $this->profile_id, $hashtag);
         }
@@ -374,18 +374,20 @@ class Notice extends Memcached_DataObject
             $notice->saveReplies();
         }
 
-        if (isset($groups)) {
-            $notice->saveKnownGroups($groups);
-        } else {
-            $notice->saveGroups();
-        }
-
         if (isset($tags)) {
             $notice->saveKnownTags($tags);
         } else {
             $notice->saveTags();
         }
 
+        // Note: groups may save tags, so must be run after tags are saved
+        // to avoid errors on duplicates.
+        if (isset($groups)) {
+            $notice->saveKnownGroups($groups);
+        } else {
+            $notice->saveGroups();
+        }
+
         if (isset($urls)) {
             $notice->saveKnownUrls($urls);
         } else {