summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-11-14 02:42:11 -0500
committerEvan Prodromou <evan@prodromou.name>2008-11-14 02:42:11 -0500
commit6b6c966369f180c43a1044eb1f445a367493cda8 (patch)
tree016de75d9a071a01b9074f06197dbe82cb4b1b59
parent11fba88213f0aa13e9e62d2a77cf3ab4fdc4ac8a (diff)
don't write notice to inbox if user isn't inboxed yet
darcs-hash:20081114074211-84dde-77dbee17b2eb5848a0aa012c6ebe352135f5e7c1.gz
-rw-r--r--classes/Notice.php31
1 files changed, 20 insertions, 11 deletions
diff --git a/classes/Notice.php b/classes/Notice.php
index 3a344e9ef..92d4b8832 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -374,14 +374,19 @@ class Notice extends Memcached_DataObject
}
function addToInboxes() {
-
- $inbox = new Notice_inbox();
-
- $inbox->query('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);
-
+ $enabled = common_config('inboxes', 'enabled');
+
+ if ($enabled === true || $enabled === 'transitional') {
+ $inbox = new Notice_inbox();
+ $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;
+ if ($enabled === 'transitional') {
+ $qry .= ' AND user.inboxed = 1';
+ }
+ $inbox->query($qry);
+ }
return;
}
@@ -389,9 +394,13 @@ class Notice extends Memcached_DataObject
function blowInboxes() {
- $inbox = new Notice_inbox();
- $inbox->notice_id = $this->id;
- $inbox->delete();
+ $enabled = common_config('inboxes', 'enabled');
+
+ if ($enabled === true || $enabled === 'transitional') {
+ $inbox = new Notice_inbox();
+ $inbox->notice_id = $this->id;
+ $inbox->delete();
+ }
return;
}