X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=actions%2Fshowprofiletag.php;h=44ded832b826e1cb8b61f044d8c6f573b4fb2ea1;hb=0a20abf1d8a9a068df9310d6903cc303f39b25ed;hp=07603d5a4be0c198f3411e3c0382129726e4a8b6;hpb=9ef13976fc0fa83ace04866b304dcc80e6adf058;p=quix0rs-gnu-social.git diff --git a/actions/showprofiletag.php b/actions/showprofiletag.php index 07603d5a4b..44ded832b8 100644 --- a/actions/showprofiletag.php +++ b/actions/showprofiletag.php @@ -44,7 +44,11 @@ class ShowprofiletagAction extends Action { parent::prepare($args); - $tagger_arg = $this->arg('tagger'); + if (common_config('singleuser', 'enabled')) { + $tagger_arg = User::singleUserNickname(); + } else { + $tagger_arg = $this->arg('tagger'); + } $tag_arg = $this->arg('tag'); $tagger = common_canonical_nickname($tagger_arg); $tag = common_canonical_tag($tag_arg); @@ -57,21 +61,18 @@ class ShowprofiletagAction extends Action $args['page'] = $this->page; } common_redirect(common_local_url('showprofiletag', $args), 301); - return false; } if (!$tagger) { // TRANS: Client error displayed when a tagger is expected but not provided. $this->clientError(_('No tagger.'), 404); - return false; } - $user = User::staticGet('nickname', $tagger); + $user = User::getKV('nickname', $tagger); if (!$user) { // TRANS: Client error displayed trying to perform an action related to a non-existing user. $this->clientError(_('No such user.'), 404); - return false; } $this->tagger = $user->getProfile(); @@ -82,9 +83,8 @@ class ShowprofiletagAction extends Action ($this->peopletag->private && $this->peopletag->tagger === $current->id)); if (!$can_see) { - // TRANS: Client error displayed trying to reference a non-existing people tag. - $this->clientError(_('No such people tag.'), 404); - return false; + // TRANS: Client error displayed trying to reference a non-existing list. + $this->clientError(_('No such list.'), 404); } $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; @@ -110,7 +110,6 @@ class ShowprofiletagAction extends Action if (!$this->peopletag) { // TRANS: Client error displayed trying to perform an action related to a non-existing user. $this->clientError(_('No such user.')); - return; } $this->showPage(); @@ -120,22 +119,22 @@ class ShowprofiletagAction extends Action { if ($this->page > 1) { if($this->peopletag->private) { - // TRANS: Title for private people tag timeline. - // TRANS: %1$s is a people tag, %2$s is a page number. + // TRANS: Title for private list timeline. + // TRANS: %1$s is a list, %2$s is a page number. return sprintf(_('Private timeline for %1$s list by you, page %2$d'), $this->peopletag->tag, $this->page); } $current = common_current_user(); if (!empty($current) && $current->id == $this->peopletag->tagger) { - // TRANS: Title for public people tag timeline where the viewer is the tagger. - // TRANS: %1$s is a people tag, %2$s is a page number. + // TRANS: Title for public list timeline where the viewer is the tagger. + // TRANS: %1$s is a list, %2$s is a page number. return sprintf(_('Timeline for %1$s list by you, page %2$d'), $this->peopletag->tag, $this->page); } - // TRANS: Title for private people tag timeline. - // TRANS: %1$s is a people tag, %2$s is the tagger's nickname, %3$d is a page number. + // TRANS: Title for private list timeline. + // TRANS: %1$s is a list, %2$s is the tagger's nickname, %3$d is a page number. return sprintf(_('Timeline for %1$s list by %2$s, page %3$d'), $this->peopletag->tag, $this->tagger->nickname, @@ -143,22 +142,22 @@ class ShowprofiletagAction extends Action ); } else { if($this->peopletag->private) { - // TRANS: Title for private people tag timeline. - // TRANS: %s is a people tag. + // TRANS: Title for private list timeline. + // TRANS: %s is a list. return sprintf(_('Private timeline of %s list by you'), $this->peopletag->tag); } $current = common_current_user(); if (!empty($current) && $current->id == $this->peopletag->tagger) { - // TRANS: Title for public people tag timeline where the viewer is the tagger. - // TRANS: %s is a people tag. + // TRANS: Title for public list timeline where the viewer is the tagger. + // TRANS: %s is a list. return sprintf(_('Timeline for %s list by you'), $this->peopletag->tag); } - // TRANS: Title for private people tag timeline. - // TRANS: %1$s is a people tag, %2$s is the tagger's nickname. + // TRANS: Title for private list timeline. + // TRANS: %1$s is a list, %2$s is the tagger's nickname. return sprintf(_('Timeline for %1$s list by %2$s'), $this->peopletag->tag, $this->tagger->nickname @@ -169,7 +168,18 @@ class ShowprofiletagAction extends Action function getFeeds() { #XXX: make these actually work - return array(new Feed(Feed::RSS2, + return array(new Feed(Feed::JSON, + common_local_url( + 'ApiTimelineList', array( + 'user' => $this->tagger->id, + 'id' => $this->peopletag->id, + 'format' => 'as' + ) + ), + // TRANS: Feed title. + // TRANS: %s is tagger's nickname. + sprintf(_('Feed for friends of %s (Activity Streams JSON)'), $this->tagger->nickname)), + new Feed(Feed::RSS2, common_local_url( 'ApiTimelineList', array( 'user' => $this->tagger->id, @@ -189,7 +199,7 @@ class ShowprofiletagAction extends Action ) ), // TRANS: Feed title. - // TRANS: %1$s is a people tag, %2$s is tagger's nickname. + // TRANS: %1$s is a list, %2$s is tagger's nickname. sprintf(_('Feed for %1$s list by %2$s (Atom)'), $this->peopletag->tag, $this->tagger->nickname ) @@ -205,8 +215,8 @@ class ShowprofiletagAction extends Action function showEmptyListMessage() { - // TRANS: Empty list message for people tag timeline. - // TRANS: %1$s is a people tag, %2$s is a tagger's nickname. + // TRANS: Empty list message for list timeline. + // TRANS: %1$s is a list, %2$s is a tagger's nickname. $message = sprintf(_('This is the timeline for %1$s list by %2$s but no one has posted anything yet.'), $this->peopletag->tag, $this->tagger->nickname) . ' '; @@ -214,11 +224,11 @@ class ShowprofiletagAction extends Action if (common_logged_in()) { $current_user = common_current_user(); if ($this->tagger->id == $current_user->id) { - // TRANS: Additional empty list message for people tag timeline for currently logged in user tagged tags. + // TRANS: Additional empty list message for list timeline for currently logged in user tagged tags. $message .= _('Try tagging more people.'); } } else { - // TRANS: Additional empty list message for people tag timeline. + // TRANS: Additional empty list message for list timeline. // TRANS: This message contains Markdown links in the form [description](link). $message .= _('Why not [register an account](%%%%action.register%%%%) and start following this timeline!'); } @@ -244,7 +254,7 @@ class ShowprofiletagAction extends Action function showNotices() { if (Event::handle('StartShowProfileTagContent', array($this))) { - $nl = new ThreadedNoticeList($this->notice, $this, $this->userProfile); + $nl = new NoticeList($this->notice, $this); $cnt = $nl->show(); @@ -287,20 +297,8 @@ class ShowprofiletagAction extends Action if (Event::handle('StartShowTaggedProfilesMiniList', array($this))) { $title = ''; - $current = common_current_user(); - if(!empty($current) && $this->peopletag->tagger == $current->id) { - // TRANS: Header on show profile tag page. - // TRANS: %s is a people tag. - $title = sprintf(_('Listed'), $this->peopletag->tag); - } else { - // TRANS: Header on show profile tag page. - // TRANS: %1$s is a people tag, %2$s is a tagger's nickname. - $title = sprintf(_('Listed'), - $this->peopletag->tag, - $this->tagger->nickname); - } - - $this->element('h2', null, $title); + // TRANS: Header on show list page. + $this->element('h2', null, _('Listed')); $cnt = 0; @@ -308,7 +306,7 @@ class ShowprofiletagAction extends Action $pml = new ProfileMiniList($profile, $this); $cnt = $pml->show(); if ($cnt == 0) { - // TRANS: Content of "People tagged x by a user" if there are no tagged users. + // TRANS: Content of "Listed" page if there are no listed users. $this->element('p', null, _('(None)')); } } @@ -319,7 +317,7 @@ class ShowprofiletagAction extends Action array('nickname' => $this->tagger->nickname, 'profiletag' => $this->peopletag->tag)), 'class' => 'more'), - // TRANS: Link for more "People tagged x by a user" + // TRANS: Link for more "People in list x by a user" // TRANS: if there are more than the mini list's maximum. _('Show all')); $this->elementEnd('p'); @@ -351,17 +349,7 @@ class ShowprofiletagAction extends Action } } - if ($cnt > PROFILES_PER_MINILIST) { - $this->elementStart('p'); - $this->element('a', array('href' => common_local_url('profiletagsubscribers', - array('nickname' => $this->tagger->nickname, - 'profiletag' => $this->peopletag->tag)), - 'class' => 'more'), - // TRANS: Link for more "People following tag x" - // TRANS: if there are more than the mini list's maximum. - _('All subscribers')); - $this->elementEnd('p'); - } + // FIXME: link to full list Event::handle('EndShowProfileTagSubscribersMiniList', array($this)); } @@ -371,10 +359,12 @@ class ShowprofiletagAction extends Action class Peopletag extends PeopletagListItem { + protected $avatarSize = AVATAR_PROFILE_SIZE; + function showStart() { $mode = $this->peopletag->private ? 'private' : 'public'; - $this->out->elementStart('div', array('class' => 'hentry peopletag peopletag-profile mode-'.$mode, + $this->out->elementStart('div', array('class' => 'h-entry peopletag peopletag-profile mode-'.$mode, 'id' => 'peopletag-' . $this->peopletag->id)); } @@ -382,9 +372,4 @@ class Peopletag extends PeopletagListItem { $this->out->elementEnd('div'); } - - function showAvatar() - { - parent::showAvatar(AVATAR_PROFILE_SIZE); - } }