Commit 76e6bee6 authored by Evan Prodromou's avatar Evan Prodromou

Make blocks work for non-subscription deliveries

parent 88f3e690
...@@ -1008,18 +1008,16 @@ class Notice extends Managed_DataObject ...@@ -1008,18 +1008,16 @@ class Notice extends Managed_DataObject
$users = $ptag->getUserSubscribers(); $users = $ptag->getUserSubscribers();
foreach ($users as $id) { foreach ($users as $id) {
if (!array_key_exists($id, $ni)) { if (!array_key_exists($id, $ni)) {
$user = User::staticGet('id', $id);
if (!$user->hasBlocked($profile)) {
$ni[$id] = NOTICE_INBOX_SOURCE_PROFILE_TAG; $ni[$id] = NOTICE_INBOX_SOURCE_PROFILE_TAG;
} }
} }
} }
}
foreach ($recipients as $recipient) { foreach ($recipients as $recipient) {
if (!array_key_exists($recipient, $ni)) { if (!array_key_exists($recipient, $ni)) {
$ni[$recipient] = NOTICE_INBOX_SOURCE_REPLY; $ni[$recipient] = NOTICE_INBOX_SOURCE_REPLY;
} }
}
// Exclude any deleted, non-local, or blocking recipients. // Exclude any deleted, non-local, or blocking recipients.
$profile = $this->getProfile(); $profile = $this->getProfile();
...@@ -1031,6 +1029,7 @@ class Notice extends Managed_DataObject ...@@ -1031,6 +1029,7 @@ class Notice extends Managed_DataObject
$originalProfile = $original->getProfile(); $originalProfile = $original->getProfile();
} }
} }
foreach ($ni as $id => $source) { foreach ($ni as $id => $source) {
$user = User::staticGet('id', $id); $user = User::staticGet('id', $id);
if (empty($user) || $user->hasBlocked($profile) || if (empty($user) || $user->hasBlocked($profile) ||
...@@ -1038,7 +1037,6 @@ class Notice extends Managed_DataObject ...@@ -1038,7 +1037,6 @@ class Notice extends Managed_DataObject
unset($ni[$id]); unset($ni[$id]);
} }
} }
}
// Give plugins a chance to filter out... // Give plugins a chance to filter out...
Event::handle('EndNoticeWhoGets', array($this, &$ni)); Event::handle('EndNoticeWhoGets', array($this, &$ni));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment