mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-07 05:11:05 +01:00
(stable) 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
40228c56a9
commit
fcebaa5097
4 changed files with 24 additions and 13 deletions
|
@ -262,8 +262,6 @@ final class PhabricatorProjectProfileController
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withParentProjectPHIDs(array($project->getPHID()))
|
->withParentProjectPHIDs(array($project->getPHID()))
|
||||||
->needImages(true)
|
->needImages(true)
|
||||||
->needMembers(true)
|
|
||||||
->needWatchers(true)
|
|
||||||
->withStatuses(
|
->withStatuses(
|
||||||
array(
|
array(
|
||||||
PhabricatorProjectStatus::STATUS_ACTIVE,
|
PhabricatorProjectStatus::STATUS_ACTIVE,
|
||||||
|
|
|
@ -31,8 +31,6 @@ final class PhabricatorProjectSubprojectsController
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withParentProjectPHIDs(array($project->getPHID()))
|
->withParentProjectPHIDs(array($project->getPHID()))
|
||||||
->needImages(true)
|
->needImages(true)
|
||||||
->needMembers(true)
|
|
||||||
->needWatchers(true)
|
|
||||||
->withIsMilestone(false)
|
->withIsMilestone(false)
|
||||||
->execute();
|
->execute();
|
||||||
} else {
|
} else {
|
||||||
|
@ -44,8 +42,6 @@ final class PhabricatorProjectSubprojectsController
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withParentProjectPHIDs(array($project->getPHID()))
|
->withParentProjectPHIDs(array($project->getPHID()))
|
||||||
->needImages(true)
|
->needImages(true)
|
||||||
->needMembers(true)
|
|
||||||
->needWatchers(true)
|
|
||||||
->withIsMilestone(true)
|
->withIsMilestone(true)
|
||||||
->setOrderVector(array('milestoneNumber', 'id'))
|
->setOrderVector(array('milestoneNumber', 'id'))
|
||||||
->execute();
|
->execute();
|
||||||
|
|
|
@ -229,6 +229,8 @@ final class PhabricatorProjectSearchEngine
|
||||||
$list = id(new PhabricatorProjectListView())
|
$list = id(new PhabricatorProjectListView())
|
||||||
->setUser($viewer)
|
->setUser($viewer)
|
||||||
->setProjects($projects)
|
->setProjects($projects)
|
||||||
|
->setShowWatching(true)
|
||||||
|
->setShowMember(true)
|
||||||
->renderList();
|
->renderList();
|
||||||
|
|
||||||
return id(new PhabricatorApplicationSearchResultView())
|
return id(new PhabricatorApplicationSearchResultView())
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
final class PhabricatorProjectListView extends AphrontView {
|
final class PhabricatorProjectListView extends AphrontView {
|
||||||
|
|
||||||
private $projects;
|
private $projects;
|
||||||
|
private $showMember;
|
||||||
|
private $showWatching;
|
||||||
|
|
||||||
public function setProjects(array $projects) {
|
public function setProjects(array $projects) {
|
||||||
$this->projects = $projects;
|
$this->projects = $projects;
|
||||||
|
@ -13,6 +15,16 @@ final class PhabricatorProjectListView extends AphrontView {
|
||||||
return $this->projects;
|
return $this->projects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setShowWatching($watching) {
|
||||||
|
$this->showWatching = $watching;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setShowMember($member) {
|
||||||
|
$this->showMember = $member;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function renderList() {
|
public function renderList() {
|
||||||
$viewer = $this->getUser();
|
$viewer = $this->getUser();
|
||||||
$viewer_phid = $viewer->getPHID();
|
$viewer_phid = $viewer->getPHID();
|
||||||
|
@ -48,15 +60,18 @@ final class PhabricatorProjectListView extends AphrontView {
|
||||||
$item->setDisabled(true);
|
$item->setDisabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$is_member = $project->isUserMember($viewer_phid);
|
if ($this->showMember) {
|
||||||
$is_watcher = $project->isUserWatcher($viewer_phid);
|
$is_member = $project->isUserMember($viewer_phid);
|
||||||
|
if ($is_member) {
|
||||||
if ($is_member) {
|
$item->addIcon('fa-user', pht('Member'));
|
||||||
$item->addIcon('fa-user', pht('Member'));
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($is_watcher) {
|
if ($this->showWatching) {
|
||||||
$item->addIcon('fa-eye', pht('Watching'));
|
$is_watcher = $project->isUserWatcher($viewer_phid);
|
||||||
|
if ($is_watcher) {
|
||||||
|
$item->addIcon('fa-eye', pht('Watching'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$list->addItem($item);
|
$list->addItem($item);
|
||||||
|
|
Loading…
Reference in a new issue