mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-16 02:20:54 +01:00
(stable) Add Member/Watcher info to search results
Summary: Fixes T12707 Adds additional information to search results for if user is a member or a watcher of a project. Also removed the icon colors, which I'll find a better way to denote in future. Test Plan: Join a project, watch a project, view results list in /projects/ Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T12707 Differential Revision: https://secure.phabricator.com/D17880
This commit is contained in:
parent
5fee24fa43
commit
40228c56a9
2 changed files with 16 additions and 4 deletions
|
@ -13,7 +13,9 @@ final class PhabricatorProjectSearchEngine
|
|||
|
||||
public function newQuery() {
|
||||
return id(new PhabricatorProjectQuery())
|
||||
->needImages(true);
|
||||
->needImages(true)
|
||||
->needMembers(true)
|
||||
->needWatchers(true);
|
||||
}
|
||||
|
||||
protected function buildCustomSearchFields() {
|
||||
|
|
|
@ -15,6 +15,7 @@ final class PhabricatorProjectListView extends AphrontView {
|
|||
|
||||
public function renderList() {
|
||||
$viewer = $this->getUser();
|
||||
$viewer_phid = $viewer->getPHID();
|
||||
$projects = $this->getProjects();
|
||||
|
||||
$handles = $viewer->loadHandles(mpull($projects, 'getPHID'));
|
||||
|
@ -26,10 +27,8 @@ final class PhabricatorProjectListView extends AphrontView {
|
|||
$id = $project->getID();
|
||||
|
||||
$icon = $project->getDisplayIconIcon();
|
||||
$color = $project->getColor();
|
||||
|
||||
$icon_icon = id(new PHUIIconView())
|
||||
->setIcon("{$icon} {$color}");
|
||||
->setIcon($icon);
|
||||
|
||||
$icon_name = $project->getDisplayIconName();
|
||||
|
||||
|
@ -49,6 +48,17 @@ final class PhabricatorProjectListView extends AphrontView {
|
|||
$item->setDisabled(true);
|
||||
}
|
||||
|
||||
$is_member = $project->isUserMember($viewer_phid);
|
||||
$is_watcher = $project->isUserWatcher($viewer_phid);
|
||||
|
||||
if ($is_member) {
|
||||
$item->addIcon('fa-user', pht('Member'));
|
||||
}
|
||||
|
||||
if ($is_watcher) {
|
||||
$item->addIcon('fa-eye', pht('Watching'));
|
||||
}
|
||||
|
||||
$list->addItem($item);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue