diff options
author | Brion Vibber <brion@pobox.com> | 2010-04-20 13:52:58 +0200 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-04-20 13:52:58 +0200 |
commit | df41287226d113f178ef66f320c8568566890fe9 (patch) | |
tree | 26cc4094f89dd76c1d95584c729ec4c32072610a /classes | |
parent | 056cce4b5eed28751bbad97e0dc826ee5310ff39 (diff) | |
parent | 61098faf5dd2685ea00c110bb4a3c871da17a300 (diff) |
Merge branch 'testing' of gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'classes')
-rw-r--r-- | classes/Notice.php | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/classes/Notice.php b/classes/Notice.php index d65f0da9a..42c235b1a 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -981,8 +981,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 */ @@ -1021,8 +1020,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 */ @@ -1082,17 +1080,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 @@ -1116,6 +1111,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(). * |