]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'master' into testing
authorBrion Vibber <brion@pobox.com>
Wed, 14 Apr 2010 09:15:21 +0000 (11:15 +0200)
committerBrion Vibber <brion@pobox.com>
Wed, 14 Apr 2010 09:15:21 +0000 (11:15 +0200)
1  2 
classes/Notice.php

diff --combined classes/Notice.php
index 998e9c92bad0c29dbe9b12b0f0cfebfc475aeda1,a8147e4c4d4ef534aad6a64709096b5c47fcf2d0..0d8525637586b26a2bc7f02ea09582c80de9660b
@@@ -148,11 -148,11 +148,11 @@@ class Notice extends Memcached_DataObje
          //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);
          }
              $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 {
          return $ids;
      }
  
 +    /**
 +     * Is this notice part of an active conversation?
 +     * 
 +     * @return boolean true if other messages exist in the same
 +     *                 conversation, false if this is the only one
 +     */
 +    function hasConversation()
 +    {
 +        if (!empty($this->conversation)) {
 +            $conversation = Notice::conversationStream(
 +                $this->conversation,
 +                1,
 +                1
 +            );
 +            if ($conversation->N > 0) {
 +                return true;
 +            }
 +        }
 +        return false;
 +    }
 +
      /**
       * @param $groups array of Group *objects*
       * @param $recipients array of profile *ids*