save notice to inbox on saveNew

darcs-hash:20081022205621-5ed1f-4103d4db9713f4e6e65647f71cc788cbee56a240.gz
This commit is contained in:
Evan Prodromou 2008-10-22 16:56:21 -04:00
parent a15034bea5
commit 74291968c4

View File

@ -132,6 +132,7 @@ class Notice extends Memcached_DataObject
$notice->blowCaches();
}
$notice->addToInboxes();
return $notice;
}
@ -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;
}
}