]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
save notice to inbox on saveNew
authorEvan Prodromou <evan@controlyourself.ca>
Wed, 22 Oct 2008 20:56:21 +0000 (16:56 -0400)
committerEvan Prodromou <evan@controlyourself.ca>
Wed, 22 Oct 2008 20:56:21 +0000 (16:56 -0400)
darcs-hash:20081022205621-5ed1f-4103d4db9713f4e6e65647f71cc788cbee56a240.gz

classes/Notice.php

index cb153a2e5f227e6e59e7934dcad1ef41e8c4820d..17e0c5a0f96068d630c244d990f8a5f2a5931a52 100644 (file)
@@ -131,7 +131,8 @@ class Notice extends Memcached_DataObject
                if (common_config('memcached', 'enabled')) {
                        $notice->blowCaches();
                }
-               
+
+               $notice->addToInboxes();
                return $notice;
        }
 
@@ -307,7 +308,7 @@ class Notice extends Memcached_DataObject
                
                return $wrapper;
        }
-       
+
        function publicStream($offset=0, $limit=20, $since_id=0, $before_id=0) {
                
                $needAnd = FALSE;
@@ -346,4 +347,17 @@ class Notice extends Memcached_DataObject
                                                                 'public',
                                                                 $offset, $limit);
        }
+       
+       function addToInboxes() {
+
+               $inbox = new Notice_inbox();
+               
+               $inbox->query('INSERT INTO notice_inbox (user_id, notice_id) ' .
+                                         'SELECT user.id, ' . $this->id . ' ' .
+                                         'FROM user JOIN subscription ON user.id = subscription.subscriber ' .
+                                         'WHERE subscription.subscribed = ' . $this->profile_id);
+               
+               return;
+       }
 }
+