mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 05:50:55 +01:00
Restrict watching and member project display better
Summary: Fixes T12713. We don't need to show watching and member info on other views other than ApplicationSearch (for now) so add a few methods to restrict the calls. Test Plan: Visit project search, profile, project home, project home with subprojects Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T12713 Differential Revision: https://secure.phabricator.com/D17883
This commit is contained in:
parent
6fa91caf32
commit
ea874a2825
4 changed files with 24 additions and 13 deletions
|
@ -259,8 +259,6 @@ final class PhabricatorProjectProfileController
|
|||
->setViewer($viewer)
|
||||
->withParentProjectPHIDs(array($project->getPHID()))
|
||||
->needImages(true)
|
||||
->needMembers(true)
|
||||
->needWatchers(true)
|
||||
->withStatuses(
|
||||
array(
|
||||
PhabricatorProjectStatus::STATUS_ACTIVE,
|
||||
|
|
|
@ -31,8 +31,6 @@ final class PhabricatorProjectSubprojectsController
|
|||
->setViewer($viewer)
|
||||
->withParentProjectPHIDs(array($project->getPHID()))
|
||||
->needImages(true)
|
||||
->needMembers(true)
|
||||
->needWatchers(true)
|
||||
->withIsMilestone(false)
|
||||
->execute();
|
||||
} else {
|
||||
|
@ -44,8 +42,6 @@ final class PhabricatorProjectSubprojectsController
|
|||
->setViewer($viewer)
|
||||
->withParentProjectPHIDs(array($project->getPHID()))
|
||||
->needImages(true)
|
||||
->needMembers(true)
|
||||
->needWatchers(true)
|
||||
->withIsMilestone(true)
|
||||
->setOrderVector(array('milestoneNumber', 'id'))
|
||||
->execute();
|
||||
|
|
|
@ -229,6 +229,8 @@ final class PhabricatorProjectSearchEngine
|
|||
$list = id(new PhabricatorProjectListView())
|
||||
->setUser($viewer)
|
||||
->setProjects($projects)
|
||||
->setShowWatching(true)
|
||||
->setShowMember(true)
|
||||
->renderList();
|
||||
|
||||
return id(new PhabricatorApplicationSearchResultView())
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
final class PhabricatorProjectListView extends AphrontView {
|
||||
|
||||
private $projects;
|
||||
private $showMember;
|
||||
private $showWatching;
|
||||
|
||||
public function setProjects(array $projects) {
|
||||
$this->projects = $projects;
|
||||
|
@ -13,6 +15,16 @@ final class PhabricatorProjectListView extends AphrontView {
|
|||
return $this->projects;
|
||||
}
|
||||
|
||||
public function setShowWatching($watching) {
|
||||
$this->showWatching = $watching;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setShowMember($member) {
|
||||
$this->showMember = $member;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function renderList() {
|
||||
$viewer = $this->getUser();
|
||||
$viewer_phid = $viewer->getPHID();
|
||||
|
@ -48,15 +60,18 @@ 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 ($this->showMember) {
|
||||
$is_member = $project->isUserMember($viewer_phid);
|
||||
if ($is_member) {
|
||||
$item->addIcon('fa-user', pht('Member'));
|
||||
}
|
||||
}
|
||||
|
||||
if ($is_watcher) {
|
||||
$item->addIcon('fa-eye', pht('Watching'));
|
||||
if ($this->showWatching) {
|
||||
$is_watcher = $project->isUserWatcher($viewer_phid);
|
||||
if ($is_watcher) {
|
||||
$item->addIcon('fa-eye', pht('Watching'));
|
||||
}
|
||||
}
|
||||
|
||||
$list->addItem($item);
|
||||
|
|
Loading…
Reference in a new issue