]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'master' into testing
authorBrion Vibber <brion@pobox.com>
Wed, 8 Sep 2010 18:47:44 +0000 (11:47 -0700)
committerBrion Vibber <brion@pobox.com>
Wed, 8 Sep 2010 18:47:44 +0000 (11:47 -0700)
1  2 
classes/Notice.php

diff --combined classes/Notice.php
index 14477b1b53a2c17122e2baafe7891c304eb678e7,b991ecbd38a153a352d8bbff0d5133a02da132b2..f1b012465b39cbd2c0766ffe8b211802d4d964b0
@@@ -121,19 -121,16 +121,19 @@@ class Notice extends Memcached_DataObje
              $deleted->insert();
          }
  
 -        // Clear related records
 +        if (Event::handle('NoticeDeleteRelated', array($this))) {
  
 -        $this->clearReplies();
 -        $this->clearRepeats();
 -        $this->clearFaves();
 -        $this->clearTags();
 -        $this->clearGroupInboxes();
 +            // Clear related records
  
 -        // NOTE: we don't clear inboxes
 -        // NOTE: we don't clear queue items
 +            $this->clearReplies();
 +            $this->clearRepeats();
 +            $this->clearFaves();
 +            $this->clearTags();
 +            $this->clearGroupInboxes();
 +
 +            // NOTE: we don't clear inboxes
 +            // NOTE: we don't clear queue items
 +        }
  
          $result = parent::delete();
  
          if (!empty($options)) {
              $options = $options + $defaults;
              extract($options);
 +        } else {
 +            extract($defaults);
          }
  
          if (!isset($is_local)) {
          if ($f2p->find()) {
              while ($f2p->fetch()) {
                  $f = File::staticGet($f2p->file_id);
-                 $att[] = clone($f);
+                 if ($f) {
+                     $att[] = clone($f);
+                 }
              }
          }
          return $att;
          if (empty($uris)) {
              return;
          }
 +
          $sender = Profile::staticGet($this->profile_id);
  
          foreach (array_unique($uris) as $uri) {
  
 -            $user = User::staticGet('uri', $uri);
 +            $profile = Profile::fromURI($uri);
  
 -            if (!empty($user)) {
 -                if ($user->hasBlocked($sender)) {
 -                    continue;
 -                }
 +            if (empty($profile)) {
 +                common_log(LOG_WARNING, "Unable to determine profile for URI '$uri'");
 +                continue;
 +            }
 +
 +            if ($profile->hasBlocked($sender)) {
 +                common_log(LOG_INFO, "Not saving reply to profile {$profile->id} ($uri) from sender {$sender->id} because of a block.");
 +                continue;
 +            }
  
 -                $reply = new Reply();
 +            $reply = new Reply();
  
 -                $reply->notice_id  = $this->id;
 -                $reply->profile_id = $user->id;
 -                common_log(LOG_INFO, __METHOD__ . ": saving reply: notice $this->id to profile $user->id");
 +            $reply->notice_id  = $this->id;
 +            $reply->profile_id = $profile->id;
  
 -                $id = $reply->insert();
 -            }
 +            common_log(LOG_INFO, __METHOD__ . ": saving reply: notice $this->id to profile $profile->id");
 +
 +            $id = $reply->insert();
          }
  
          return;