notice inbox only when not already exists

darcs-hash:20081121184132-84dde-39d090e8bf82d10f3aa3a55ada3f4170c01e11d1.gz
This commit is contained in:
Evan Prodromou 2008-11-21 13:41:32 -05:00
parent faefe8f35c
commit a730ad708c

View File

@ -386,7 +386,11 @@ class Notice extends Memcached_DataObject
$qry = 'INSERT INTO notice_inbox (user_id, notice_id, created) ' .
'SELECT user.id, ' . $this->id . ', "' . $this->created . '" ' .
'FROM user JOIN subscription ON user.id = subscription.subscriber ' .
'WHERE subscription.subscribed = ' . $this->profile_id;
'WHERE subscription.subscribed = ' . $this->profile_id . ' ' .
'AND NOT EXISTS (SELECT user_id, notice_id ' .
'FROM notice_inbox ' .
'WHERE user_id = user.id ' .
'AND notice_id = ' . $this->id . ' )';
if ($enabled === 'transitional') {
$qry .= ' AND user.inboxed = 1';
}