forked from GNUsocial/gnu-social
getStreamName will now return nick/fullname based on current user's preferred representation
This commit is contained in:
parent
09ef1fff69
commit
20bd0c1136
@ -192,6 +192,20 @@ class Profile extends Managed_DataObject
|
||||
return ($this->fullname) ? $this->fullname : $this->nickname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes the currently scoped profile into account to give a name
|
||||
* to list in notice streams. Preferences may differ between profiles.
|
||||
*/
|
||||
function getStreamName()
|
||||
{
|
||||
$user = common_current_user();
|
||||
if ($user instanceof User && $user->streamNicknames()) {
|
||||
return $this->nickname;
|
||||
}
|
||||
|
||||
return $this->getBestName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the full name (if filled) with nickname as a parenthetical, or the nickname alone
|
||||
* if no fullname is provided.
|
||||
|
@ -222,14 +222,7 @@ class NoticeListItem extends Widget
|
||||
$this->out->elementStart('a', $attrs);
|
||||
$this->showAvatar();
|
||||
$this->out->text(' ');
|
||||
$user = common_current_user();
|
||||
if (!empty($user) && $user->streamNicknames()) {
|
||||
$this->out->element('span',array('class' => 'fn'),
|
||||
$this->profile->nickname);
|
||||
} else {
|
||||
$this->out->element('span',array('class' => 'fn'),
|
||||
$this->profile->getBestName());
|
||||
}
|
||||
$this->out->element('span',array('class' => 'fn'), $this->profile->getStreamName());
|
||||
$this->out->elementEnd('a');
|
||||
|
||||
$this->out->elementEnd('span');
|
||||
@ -268,16 +261,12 @@ class NoticeListItem extends Widget
|
||||
|
||||
$attentions = $this->getReplyProfiles();
|
||||
|
||||
$user = common_current_user();
|
||||
|
||||
$streamNicknames = !empty($user) && $user->streamNicknames();
|
||||
|
||||
foreach ($attentions as $attn) {
|
||||
$class = $attn->isGroup() ? 'group' : 'account';
|
||||
$pa[] = array('href' => $attn->profileurl,
|
||||
'title' => $attn->nickname,
|
||||
'class' => "addressee {$class}",
|
||||
'text' => ($streamNicknames) ? $attn->nickname : $attn->getBestName());
|
||||
'text' => $attn->getStreamName());
|
||||
}
|
||||
|
||||
return $pa;
|
||||
|
Loading…
Reference in New Issue
Block a user