Don't email users who are sandboxed
If sandboxed or silenced, don't email the user any notifications.
This commit is contained in:
parent
aaba2036fa
commit
40416c2c69
@ -658,6 +658,21 @@ class User extends Managed_DataObject
|
||||
return $this->getProfile()->isSilenced();
|
||||
}
|
||||
|
||||
function receivesEmailNotifications()
|
||||
{
|
||||
// We could do this in one large if statement, but that's not as easy to read
|
||||
// Don't send notifications if we don't know the user's email address or it is
|
||||
// explicitly undesired by the user's own settings.
|
||||
if (empty($this->email) || !$this->emailnotifyattn) {
|
||||
return false;
|
||||
}
|
||||
// Don't send notifications to a user who is sandboxed or silenced
|
||||
if ($this->isSandboxed() || $this->isSilenced()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function repeatedByMe($offset=0, $limit=20, $since_id=null, $max_id=null)
|
||||
{
|
||||
$stream = new RepeatedByMeNoticeStream($this);
|
||||
|
@ -737,7 +737,7 @@ function mail_notify_fave(User $rcpt, Profile $sender, Notice $notice)
|
||||
*/
|
||||
function mail_notify_attn($user, $notice)
|
||||
{
|
||||
if (!$user->email || !$user->emailnotifyattn) {
|
||||
if (!$user->receivesEmailNotifications()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -747,12 +747,13 @@ function mail_notify_attn($user, $notice)
|
||||
return;
|
||||
}
|
||||
|
||||
// See if the notice's author who mentions this user is sandboxed
|
||||
if (!$sender->hasRight(Right::EMAILONREPLY)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the author has blocked the author, don't spam them with a notification.
|
||||
if ($user->hasBlocked($sender)) {
|
||||
// If the author has blocked us, don't spam them with a notification.
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user