]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch '0.7.x' into 0.8.x
authorSarven Capadisli <csarven@controlyourself.ca>
Tue, 5 May 2009 22:54:46 +0000 (22:54 +0000)
committerSarven Capadisli <csarven@controlyourself.ca>
Tue, 5 May 2009 22:54:46 +0000 (22:54 +0000)
1  2 
classes/Notice.php

diff --combined classes/Notice.php
index 19ae8313cdd731ec8c9b9b03bea2e9b8de47d53b,771a4e715f3d51811240c341defc381dced3fe33..382d160ab3fbe5c122f0e1cffa7b4bcc0ffc517a
@@@ -46,7 -46,6 +46,7 @@@ class Notice extends Memcached_DataObje
      public $reply_to;                        // int(4)
      public $is_local;                        // tinyint(1)
      public $source;                          // varchar(32)
 +    public $conversation;                    // int(4)
  
      /* Static get */
      function staticGet($k,$v=NULL) {
                $notice->source = $source;
                $notice->uri = $uri;
  
 +        if (!empty($reply_to)) {
 +            $reply_notice = Notice::staticGet('id', $reply_to);
 +            if (!empty($reply_notice)) {
 +                $notice->reply_to = $reply_to;
 +                $notice->conversation = $reply_notice->conversation;
 +            }
 +        }
 +
          if (Event::handle('StartNoticeSave', array(&$notice))) {
  
              $id = $notice->insert();
              $group_inbox->notice_id = $this->id;
              if ($group_inbox->find()) {
                  while ($group_inbox->fetch()) {
-                     $cache->delete(common_cache_key('group:notices:'.$group_inbox->group_id));
+                     $cache->delete(common_cache_key('user_group:notice_ids:' . $group_inbox->group_id));
                      if ($blowLast) {
-                         $cache->delete(common_cache_key('group:notices:'.$group_inbox->group_id.';last'));
+                         $cache->delete(common_cache_key('user_group:notice_ids:' . $group_inbox->group_id.';last'));
                      }
                      $member = new Group_member();
                      $member->group_id = $group_inbox->group_id;
              $tag->notice_id = $this->id;
              if ($tag->find()) {
                  while ($tag->fetch()) {
-                     $cache->delete(common_cache_key('notice_tag:notice_stream:' . $tag->tag));
-                     if ($blowLast) {
-                         $cache->delete(common_cache_key('notice_tag:notice_stream:' . $tag->tag . ';last'));
-                     }
+                     $tag->blowCache($blowLast);
                  }
              }
              $tag->free();
      {
          if ($this->is_local) {
              $cache = common_memcache();
-             if ($cache) {
-                 $cache->delete(common_cache_key('profile:notices:'.$this->profile_id));
+             if (!empty($cache)) {
+                 $cache->delete(common_cache_key('profile:notice_ids:'.$this->profile_id));
                  if ($blowLast) {
-                     $cache->delete(common_cache_key('profile:notices:'.$this->profile_id.';last'));
+                     $cache->delete(common_cache_key('profile:notice_ids:'.$this->profile_id.';last'));
                  }
              }
          }
              $reply->notice_id = $this->id;
              if ($reply->find()) {
                  while ($reply->fetch()) {
-                     $cache->delete(common_cache_key('user:replies:'.$reply->profile_id));
+                     $cache->delete(common_cache_key('reply:stream:'.$reply->profile_id));
                      if ($blowLast) {
-                         $cache->delete(common_cache_key('user:replies:'.$reply->profile_id.';last'));
+                         $cache->delete(common_cache_key('reply:stream:'.$reply->profile_id.';last'));
                      }
                  }
              }
              $fave->notice_id = $this->id;
              if ($fave->find()) {
                  while ($fave->fetch()) {
-                     $cache->delete(common_cache_key('user:faves:'.$fave->user_id));
+                     $cache->delete(common_cache_key('fave:ids_by_user:'.$fave->user_id));
                      if ($blowLast) {
-                         $cache->delete(common_cache_key('user:faves:'.$fave->user_id.';last'));
+                         $cache->delete(common_cache_key('fave:ids_by_user:'.$fave->user_id.';last'));
                      }
                  }
              }
                  if ($recipient_notice) {
                      $orig = clone($this);
                      $this->reply_to = $recipient_notice->id;
 +                    $this->conversation = $recipient_notice->conversation;
                      $this->update($orig);
                  }
              }
              }
          }
  
 +        // If it's not a reply, make it the root of a new conversation
 +
 +        if (empty($this->conversation)) {
 +            $orig = clone($this);
 +            $this->conversation = $this->id;
 +            $this->update($orig);
 +        }
 +
          foreach (array_keys($replied) as $recipient) {
              $user = User::staticGet('id', $recipient);
              if ($user) {