summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-04-20 13:52:18 +0200
committerBrion Vibber <brion@pobox.com>2010-04-20 13:52:18 +0200
commit61098faf5dd2685ea00c110bb4a3c871da17a300 (patch)
tree802849c215ddcc93beada58f4c80c2a4ca1aa763 /classes
parent32918bb7c18c6c098a16e88d169099c6ce371dfe (diff)
parentc48caa85e12063c2df9913957dbd11af6b5e3ea6 (diff)
Merge branch 'master' of gitorious.org:statusnet/mainline into testing
Diffstat (limited to 'classes')
-rw-r--r--classes/Notice.php44
1 files changed, 32 insertions, 12 deletions
diff --git a/classes/Notice.php b/classes/Notice.php
index 0d8525637..5c75ec520 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -980,8 +980,7 @@ class Notice extends Memcached_DataObject
* messages, we won't deliver to any remote targets as that's the
* source service's responsibility.
*
- * @fixme Unlike saveReplies() there's no mail notification here.
- * Move that to distrib queue handler?
+ * Mail notifications etc will be handled later.
*
* @param array of unique identifier URIs for recipients
*/
@@ -1020,8 +1019,7 @@ class Notice extends Memcached_DataObject
* and save reply records indicating that this message needs to be
* delivered to those users.
*
- * Side effect: local recipients get e-mail notifications here.
- * @fixme move mail notifications to distrib?
+ * Mail notifications to local profiles will be sent later.
*
* @return array of integer profile IDs
*/
@@ -1081,17 +1079,14 @@ class Notice extends Memcached_DataObject
$recipientIds = array_keys($replied);
- foreach ($recipientIds as $recipientId) {
- $user = User::staticGet('id', $recipientId);
- if (!empty($user)) {
- self::blow('reply:stream:%d', $reply->profile_id);
- mail_notify_attn($user, $this);
- }
- }
-
return $recipientIds;
}
+ /**
+ * Pull the complete list of @-reply targets for this notice.
+ *
+ * @return array of integer profile ids
+ */
function getReplies()
{
// XXX: cache me
@@ -1115,6 +1110,31 @@ class Notice extends Memcached_DataObject
}
/**
+ * Send e-mail notifications to local @-reply targets.
+ *
+ * Replies must already have been saved; this is expected to be run
+ * from the distrib queue handler.
+ */
+ function sendReplyNotifications()
+ {
+ // Don't send reply notifications for repeats
+
+ if (!empty($this->repeat_of)) {
+ return array();
+ }
+
+ $recipientIds = $this->getReplies();
+
+ foreach ($recipientIds as $recipientId) {
+ $user = User::staticGet('id', $recipientId);
+ if (!empty($user)) {
+ self::blow('reply:stream:%d', $recipientId);
+ mail_notify_attn($user, $this);
+ }
+ }
+ }
+
+ /**
* Pull list of groups this notice needs to be delivered to,
* as previously recorded by saveGroups() or saveKnownGroups().
*