diff options
author | Evan Prodromou <evan@prodromou.name> | 2008-11-21 13:41:32 -0500 |
---|---|---|
committer | Evan Prodromou <evan@prodromou.name> | 2008-11-21 13:41:32 -0500 |
commit | a730ad708c0e036691e26687cc7ec41d57c6db40 (patch) | |
tree | 928a3af8826e968585db6b423f61a13689fd8385 | |
parent | faefe8f35c2078ab1185aa3406df3896780675b2 (diff) |
notice inbox only when not already exists
darcs-hash:20081121184132-84dde-39d090e8bf82d10f3aa3a55ada3f4170c01e11d1.gz
-rw-r--r-- | classes/Notice.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/classes/Notice.php b/classes/Notice.php index c392c39c9..21b676ba3 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -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'; } |