Notification mails are sent again fixes ssue #99

The problem was that the ActivityVerbPostPlugin handled 'post' verbs
but didn't handle the notifications for them, so now we're returning
true in the event so the default behaviour (sending to 'getReplies'
recipients) is done by default.
This commit is contained in:
Mikael Nordfeldth 2015-12-30 17:35:47 +01:00
parent ad5d5f8054
commit 998db39b1a
3 changed files with 9 additions and 10 deletions

View File

@ -1732,7 +1732,6 @@ class Notice extends Managed_DataObject
function sendReplyNotifications()
{
// Don't send reply notifications for repeats
if ($this->isRepeat()) {
return array();
}
@ -1742,9 +1741,11 @@ class Notice extends Managed_DataObject
require_once INSTALLDIR.'/lib/mail.php';
foreach ($recipientIds as $recipientId) {
$user = User::getKV('id', $recipientId);
if ($user instanceof User) {
try {
$user = User::getByID($recipientId);
mail_notify_attn($user, $this);
} catch (NoResultException $e) {
// No such user
}
}
Event::handle('EndNotifyMentioned', array($this, $recipientIds));

View File

@ -233,6 +233,9 @@ abstract class ActivityHandlerPlugin extends Plugin
protected function notifyMentioned(Notice $stored, array &$mentioned_ids)
{
// pass through silently by default
// If we want to stop any other plugin from notifying based on this activity, return false instead.
return true;
}
/**
@ -305,10 +308,7 @@ abstract class ActivityHandlerPlugin extends Plugin
return true;
}
$this->notifyMentioned($stored, $mentioned_ids);
// If it was _our_ notice, only we should do anything with the mentions.
return false;
return $this->notifyMentioned($stored, $mentioned_ids);
}
/**

View File

@ -30,9 +30,7 @@
* @link http://status.net/
*/
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
if (!defined('GNUSOCIAL')) { exit(1); }
require_once 'Mail.php';