Skip to content

Commit

Permalink
Hide notices from members the currently logged-in user has blocked
Browse files Browse the repository at this point in the history
  • Loading branch information
RedEnchilada committed Sep 5, 2014
1 parent d0f245c commit 17c5942
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
18 changes: 18 additions & 0 deletions actions/showstream.php
Expand Up @@ -220,6 +220,16 @@ function extraHead()
'href' => $rsd));
}

function showBlockedListMessage()
{
// TRANS: First sentence of empty list message for a timeline. $1%s is a user nickname.
$message = sprintf(_('This is the timeline for %1$s, but you have blocked %1$s, so their notices will not show up for you.'), $this->user->nickname) . ' ';

$this->elementStart('div', 'guide');
$this->raw(common_markup_to_html($message));
$this->elementEnd('div');
}

function showEmptyListMessage()
{
// TRANS: First sentence of empty list message for a timeline. $1%s is a user nickname.
Expand Down Expand Up @@ -249,6 +259,14 @@ function showEmptyListMessage()

function showNotices()
{
if (common_logged_in()) {
$u = common_current_user();
if ($u->hasBlocked($this->user)) {
$this->showBlockedListMessage();
return;
}
}

$pnl = null;
if (Event::handle('ShowStreamNoticeList', array($this->notice, $this, &$pnl))) {
$pnl = new ProfileNoticeList($this->notice, $this);
Expand Down
6 changes: 6 additions & 0 deletions classes/Notice.php
Expand Up @@ -2404,6 +2404,12 @@ protected function _inScope($profile)
} else {
$scope = self::defaultScope();
}

// If user has blocked this notice's owner, hide it regardless

if ($profile && $profile->hasBlocked($this->getProfile())) {
return false;
}

// If there's no scope, anyone (even anon) is in scope.

Expand Down

0 comments on commit 17c5942

Please sign in to comment.