Changed ShowfavoritesAction to use Action functions for profiles

This commit is contained in:
Mikael Nordfeldth 2016-07-07 11:11:20 +02:00
parent 6332a4d800
commit 1d53e7060a

View File

@ -65,53 +65,52 @@ class ShowfavoritesAction extends ShowstreamAction
return array(new Feed(Feed::JSON, return array(new Feed(Feed::JSON,
common_local_url('ApiTimelineFavorites', common_local_url('ApiTimelineFavorites',
array( array(
'id' => $this->user->nickname, 'id' => $this->getTarget()->getNickname(),
'format' => 'as')), 'format' => 'as')),
// TRANS: Feed link text. %s is a username. // TRANS: Feed link text. %s is a username.
sprintf(_('Feed for favorites of %s (Activity Streams JSON)'), sprintf(_('Feed for favorites of %s (Activity Streams JSON)'),
$this->user->nickname)), $this->getTarget()->getNickname())),
new Feed(Feed::RSS1, new Feed(Feed::RSS1,
common_local_url('favoritesrss', common_local_url('favoritesrss',
array('nickname' => $this->user->nickname)), array('nickname' => $this->getTarget()->getNickname())),
// TRANS: Feed link text. %s is a username. // TRANS: Feed link text. %s is a username.
sprintf(_('Feed for favorites of %s (RSS 1.0)'), sprintf(_('Feed for favorites of %s (RSS 1.0)'),
$this->user->nickname)), $this->getTarget()->getNickname())),
new Feed(Feed::RSS2, new Feed(Feed::RSS2,
common_local_url('ApiTimelineFavorites', common_local_url('ApiTimelineFavorites',
array( array(
'id' => $this->user->nickname, 'id' => $this->getTarget()->getNickname(),
'format' => 'rss')), 'format' => 'rss')),
// TRANS: Feed link text. %s is a username. // TRANS: Feed link text. %s is a username.
sprintf(_('Feed for favorites of %s (RSS 2.0)'), sprintf(_('Feed for favorites of %s (RSS 2.0)'),
$this->user->nickname)), $this->getTarget()->getNickname())),
new Feed(Feed::ATOM, new Feed(Feed::ATOM,
common_local_url('ApiTimelineFavorites', common_local_url('ApiTimelineFavorites',
array( array(
'id' => $this->user->nickname, 'id' => $this->getTarget()->getNickname(),
'format' => 'atom')), 'format' => 'atom')),
// TRANS: Feed link text. %s is a username. // TRANS: Feed link text. %s is a username.
sprintf(_('Feed for favorites of %s (Atom)'), sprintf(_('Feed for favorites of %s (Atom)'),
$this->user->nickname))); $this->getTarget()->getNickname())));
} }
function showEmptyListMessage() function showEmptyListMessage()
{ {
if (common_logged_in()) { if (common_logged_in()) {
$current_user = common_current_user(); if ($this->getTarget()->sameAs($this->getScoped())) {
if ($this->user->id === $current_user->id) {
// TRANS: Text displayed instead of favourite notices for the current logged in user that has no favourites. // TRANS: Text displayed instead of favourite notices for the current logged in user that has no favourites.
$message = _('You haven\'t chosen any favorite notices yet. Click the fave button on notices you like to bookmark them for later or shed a spotlight on them.'); $message = _('You haven\'t chosen any favorite notices yet. Click the fave button on notices you like to bookmark them for later or shed a spotlight on them.');
} else { } else {
// TRANS: Text displayed instead of favourite notices for a user that has no favourites while logged in. // TRANS: Text displayed instead of favourite notices for a user that has no favourites while logged in.
// TRANS: %s is a username. // TRANS: %s is a username.
$message = sprintf(_('%s hasn\'t added any favorite notices yet. Post something interesting they would add to their favorites :)'), $this->user->nickname); $message = sprintf(_('%s hasn\'t added any favorite notices yet. Post something interesting they would add to their favorites :)'), $this->getTarget()->getNickname());
} }
} }
else { else {
// TRANS: Text displayed instead of favourite notices for a user that has no favourites while not logged in. // TRANS: Text displayed instead of favourite notices for a user that has no favourites while not logged in.
// TRANS: %s is a username, %%%%action.register%%%% is a link to the user registration page. // TRANS: %s is a username, %%%%action.register%%%% is a link to the user registration page.
// TRANS: (link text)[link] is a Mark Down link. // TRANS: (link text)[link] is a Mark Down link.
$message = sprintf(_('%s hasn\'t added any favorite notices yet. Why not [register an account](%%%%action.register%%%%) and then post something interesting they would add to their favorites :)'), $this->user->nickname); $message = sprintf(_('%s hasn\'t added any favorite notices yet. Why not [register an account](%%%%action.register%%%%) and then post something interesting they would add to their favorites :)'), $this->getTarget()->getNickname());
} }
$this->elementStart('div', 'guide'); $this->elementStart('div', 'guide');