Differential D20358 Diff 48609 src/applications/search/menuitem/PhabricatorConpherenceProfileMenuItem.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/search/menuitem/PhabricatorConpherenceProfileMenuItem.php
Show All 35 Lines | public function getConpherence() { | ||||
if (!$conpherence) { | if (!$conpherence) { | ||||
return null; | return null; | ||||
} | } | ||||
return $conpherence; | return $conpherence; | ||||
} | } | ||||
public function willBuildNavigationItems(array $items) { | public function willGetMenuItemViewList(array $items) { | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
$room_phids = array(); | $room_phids = array(); | ||||
foreach ($items as $item) { | foreach ($items as $item) { | ||||
$room_phids[] = $item->getMenuItemProperty('conpherence'); | $room_phids[] = $item->getMenuItemProperty('conpherence'); | ||||
} | } | ||||
$rooms = id(new ConpherenceThreadQuery()) | $rooms = id(new ConpherenceThreadQuery()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
Show All 40 Lines | public function buildEditEngineFields( | ||||
); | ); | ||||
} | } | ||||
private function getName( | private function getName( | ||||
PhabricatorProfileMenuItemConfiguration $config) { | PhabricatorProfileMenuItemConfiguration $config) { | ||||
return $config->getMenuItemProperty('name'); | return $config->getMenuItemProperty('name'); | ||||
} | } | ||||
protected function newNavigationMenuItems( | protected function newMenuItemViewList( | ||||
PhabricatorProfileMenuItemConfiguration $config) { | PhabricatorProfileMenuItemConfiguration $config) { | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
$room = $this->getConpherence($config); | $room = $this->getConpherence($config); | ||||
if (!$room) { | if (!$room) { | ||||
return array(); | return array(); | ||||
} | } | ||||
$participants = $room->getParticipants(); | $participants = $room->getParticipants(); | ||||
$viewer_phid = $viewer->getPHID(); | $viewer_phid = $viewer->getPHID(); | ||||
$unread_count = null; | $unread_count = null; | ||||
if (isset($participants[$viewer_phid])) { | if (isset($participants[$viewer_phid])) { | ||||
$data = $room->getDisplayData($viewer); | $data = $room->getDisplayData($viewer); | ||||
$unread_count = $data['unread_count']; | $unread_count = $data['unread_count']; | ||||
} | } | ||||
$count = null; | $item = $this->newItemView() | ||||
->setURI('/'.$room->getMonogram()) | |||||
->setName($this->getDisplayName($config)) | |||||
->setIcon('fa-comments'); | |||||
if ($unread_count) { | if ($unread_count) { | ||||
$count = phutil_tag( | $item->newCount($unread_count); | ||||
'span', | |||||
array( | |||||
'class' => 'phui-list-item-count', | |||||
), | |||||
$unread_count); | |||||
} | } | ||||
$item = $this->newItem() | |||||
->setHref('/'.$room->getMonogram()) | |||||
->setName($this->getDisplayName($config)) | |||||
->setIcon('fa-comments') | |||||
->appendChild($count); | |||||
return array( | return array( | ||||
$item, | $item, | ||||
); | ); | ||||
} | } | ||||
public function validateTransactions( | public function validateTransactions( | ||||
PhabricatorProfileMenuItemConfiguration $config, | PhabricatorProfileMenuItemConfiguration $config, | ||||
$field_key, | $field_key, | ||||
▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines |