]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
make sure not to forward blocked users
authorEvan Prodromou <evan@status.net>
Tue, 8 Dec 2009 22:42:07 +0000 (17:42 -0500)
committerEvan Prodromou <evan@status.net>
Tue, 8 Dec 2009 22:42:07 +0000 (17:42 -0500)
classes/Forward.php

index 52ec5387155d8ea88b2719d32b9fd0a1144cd33c..e9b83a58bfda9b64ceba7b653a2d712a6e6e39b2 100644 (file)
@@ -77,23 +77,33 @@ class Forward extends Memcached_DataObject
 
         $user = new User();
 
-        $user->query('SELECT id FROM user JOIN subscription ON user.id = subscription.subscriber '.
+        $user->query('SELECT user.* FROM user JOIN subscription ON user.id = subscription.subscriber '.
                      'WHERE subscription.subscribed = '.$this->profile_id);
 
         $ni = array();
 
+        $notice = Notice::staticGet('id', $this->notice_id);
+
+        $author = Profile::staticGet('id', $notice->profile_id);
+
         while ($user->fetch()) {
             $inbox = Notice_inbox::pkeyGet(array('user_id' => $user->id,
                                                  'notice_id' => $this->notice_id));
 
             if (empty($inbox)) {
-                $ni[$user->id] = NOTICE_INBOX_SOURCE_FORWARD;
+                if (!$user->hasBlocked($author)) {
+                    $ni[$user->id] = NOTICE_INBOX_SOURCE_FORWARD;
+                }
             } else {
                 $inbox->free();
             }
         }
 
         $user->free();
+        $author->free();
+
+        unset($user);
+        unset($author);
 
         Notice_inbox::bulkInsert($this->notice_id, $this->created, $ni);