From a730ad708c0e036691e26687cc7ec41d57c6db40 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 21 Nov 2008 13:41:32 -0500 Subject: notice inbox only when not already exists darcs-hash:20081121184132-84dde-39d090e8bf82d10f3aa3a55ada3f4170c01e11d1.gz --- classes/Notice.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'classes') 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'; } -- cgit v1.2.3-54-g00ecf