Don't show empty addressees in noticelistitem
This commit is contained in:
parent
d544c78276
commit
ac55efeecf
@ -229,43 +229,15 @@ class NoticeListItem extends Widget
|
||||
|
||||
function showAddressees()
|
||||
{
|
||||
$ga = $this->getGroupAddressees();
|
||||
$pa = $this->getProfileAddressees();
|
||||
|
||||
$a = array_merge($ga, $pa);
|
||||
|
||||
if (!empty($a)) {
|
||||
$this->out->elementStart('span', 'addressees');
|
||||
|
||||
$cnt = $this->showGroupAddressees(true);
|
||||
$cnt = $this->showProfileAddressees($cnt == 0);
|
||||
|
||||
$this->out->elementEnd('span', 'addressees');
|
||||
}
|
||||
|
||||
function showGroupAddressees($first)
|
||||
{
|
||||
$groups = $this->getGroups();
|
||||
|
||||
foreach ($groups as $group) {
|
||||
if (!$first) {
|
||||
$this->out->text( _m('SEPARATOR',', '));
|
||||
} else {
|
||||
$first = false;
|
||||
}
|
||||
$this->out->element('a', array('href' => $group->homeUrl(),
|
||||
'title' => $group->nickname,
|
||||
'class' => 'addressee group'),
|
||||
$group->getBestName());
|
||||
}
|
||||
|
||||
return count($groups);
|
||||
}
|
||||
|
||||
function getGroups()
|
||||
{
|
||||
return $this->notice->getGroups();
|
||||
}
|
||||
|
||||
function showProfileAddressees($first)
|
||||
{
|
||||
$replies = $this->getReplyProfiles();
|
||||
|
||||
foreach ($replies as $reply) {
|
||||
$first = true;
|
||||
foreach ($a as $addr) {
|
||||
if (!$first) {
|
||||
// TRANS: Separator in profile addressees list.
|
||||
$this->out->text(_m('SEPARATOR',', '));
|
||||
@ -273,13 +245,49 @@ class NoticeListItem extends Widget
|
||||
// TRANS: Start of profile addressees list.
|
||||
$first = false;
|
||||
}
|
||||
$this->out->element('a', array('href' => $reply->profileurl,
|
||||
'title' => $reply->nickname,
|
||||
'class' => 'addressee account'),
|
||||
$reply->getBestName());
|
||||
$text = $addr['text'];
|
||||
unset($addr['text']);
|
||||
$this->out->element('a', $addr, $text);
|
||||
}
|
||||
$this->out->elementEnd('span', 'addressees');
|
||||
}
|
||||
}
|
||||
|
||||
return count($replies);
|
||||
function getGroupAddressees()
|
||||
{
|
||||
$ga = array();
|
||||
|
||||
$groups = $this->getGroups();
|
||||
|
||||
foreach ($groups as $group) {
|
||||
$ga[] = array('href' => $group->homeUrl(),
|
||||
'title' => $group->nickname,
|
||||
'class' => 'addressee group',
|
||||
'text' => $group->getBestName());
|
||||
}
|
||||
|
||||
return $ga;
|
||||
}
|
||||
|
||||
function getGroups()
|
||||
{
|
||||
return $this->notice->getGroups();
|
||||
}
|
||||
|
||||
function getProfileAddressees()
|
||||
{
|
||||
$pa = array();
|
||||
|
||||
$replies = $this->getReplyProfiles();
|
||||
|
||||
foreach ($replies as $reply) {
|
||||
$pa[] = array('href' => $reply->profileurl,
|
||||
'title' => $reply->nickname,
|
||||
'class' => 'addressee account',
|
||||
'text' => $reply->getBestName());
|
||||
}
|
||||
|
||||
return $pa;
|
||||
}
|
||||
|
||||
function getReplyProfiles()
|
||||
|
Loading…
Reference in New Issue
Block a user