Page MenuHomePhabricator

D15063.id36372.diff
No OneTemporary

D15063.id36372.diff

diff --git a/src/applications/project/controller/PhabricatorProjectMembersViewController.php b/src/applications/project/controller/PhabricatorProjectMembersViewController.php
--- a/src/applications/project/controller/PhabricatorProjectMembersViewController.php
+++ b/src/applications/project/controller/PhabricatorProjectMembersViewController.php
@@ -152,22 +152,22 @@
->setDisabled(!$can_leave)
->setWorkflow(true)
->setName(pht('Leave Project')));
+ }
- if (!$project->isUserWatcher($viewer->getPHID())) {
- $view->addAction(
- id(new PhabricatorActionView())
- ->setWorkflow(true)
- ->setHref('/project/watch/'.$project->getID().'/')
- ->setIcon('fa-eye')
- ->setName(pht('Watch Project')));
- } else {
- $view->addAction(
- id(new PhabricatorActionView())
- ->setWorkflow(true)
- ->setHref('/project/unwatch/'.$project->getID().'/')
- ->setIcon('fa-eye-slash')
- ->setName(pht('Unwatch Project')));
- }
+ if (!$project->isUserWatcher($viewer->getPHID())) {
+ $view->addAction(
+ id(new PhabricatorActionView())
+ ->setWorkflow(true)
+ ->setHref('/project/watch/'.$project->getID().'/')
+ ->setIcon('fa-eye')
+ ->setName(pht('Watch Project')));
+ } else {
+ $view->addAction(
+ id(new PhabricatorActionView())
+ ->setWorkflow(true)
+ ->setHref('/project/unwatch/'.$project->getID().'/')
+ ->setIcon('fa-eye-slash')
+ ->setName(pht('Unwatch Project')));
}
$can_add = $can_edit && $supports_edit;
diff --git a/src/applications/project/controller/PhabricatorProjectProfileController.php b/src/applications/project/controller/PhabricatorProjectProfileController.php
--- a/src/applications/project/controller/PhabricatorProjectProfileController.php
+++ b/src/applications/project/controller/PhabricatorProjectProfileController.php
@@ -52,6 +52,7 @@
$nav = $this->getProfileMenu();
$nav->selectFilter(PhabricatorProject::PANEL_PROFILE);
+ $watch_action = $this->renderWatchAction($project);
$stories = id(new PhabricatorFeedQuery())
->setViewer($viewer)
@@ -62,10 +63,15 @@
->setLimit(50)
->execute();
+
$feed = $this->renderStories($stories);
+ $feed_header = id(new PHUIHeaderView())
+ ->setHeader(pht('Recent Activity'))
+ ->addActionLink($watch_action);
+
$feed = id(new PHUIObjectBoxView())
- ->setHeaderText(pht('Recent Activity'))
+ ->setHeader($feed_header)
->appendChild($feed);
$columns = id(new AphrontMultiColumnView())
@@ -144,4 +150,33 @@
return phutil_tag_div('profile-feed', $view->render());
}
+ private function renderWatchAction(PhabricatorProject $project) {
+ $viewer = $this->getViewer();
+ $viewer_phid = $viewer->getPHID();
+ $id = $project->getID();
+
+ $is_watcher = ($viewer_phid && $project->isUserWatcher($viewer_phid));
+
+ if (!$is_watcher) {
+ $watch_icon = 'fa-eye';
+ $watch_text = pht('Watch Project');
+ $watch_href = "/project/watch/{$id}/?via=profile";
+ } else {
+ $watch_icon = 'fa-eye-slash';
+ $watch_text = pht('Unwatch Project');
+ $watch_href = "/project/unwatch/{$id}/?via=profile";
+ }
+
+ $watch_icon = id(new PHUIIconView())
+ ->setIconFont($watch_icon);
+
+ return id(new PHUIButtonView())
+ ->setTag('a')
+ ->setWorkflow(true)
+ ->setIcon($watch_icon)
+ ->setText($watch_text)
+ ->setHref($watch_href);
+ }
+
+
}
diff --git a/src/applications/project/controller/PhabricatorProjectWatchController.php b/src/applications/project/controller/PhabricatorProjectWatchController.php
--- a/src/applications/project/controller/PhabricatorProjectWatchController.php
+++ b/src/applications/project/controller/PhabricatorProjectWatchController.php
@@ -18,11 +18,11 @@
return new Aphront404Response();
}
- $done_uri = "/project/members/{$id}/";
-
- // You must be a member of a project to watch it.
- if (!$project->isUserMember($viewer->getPHID())) {
- return new Aphront400Response();
+ $via = $request->getStr('via');
+ if ($via == 'profile') {
+ $done_uri = $project->getURI();
+ } else {
+ $done_uri = "/project/members/{$id}/";
}
if ($request->isDialogFormPost()) {
@@ -38,7 +38,7 @@
break;
}
- $type_member = PhabricatorObjectHasWatcherEdgeType::EDGECONST;
+ $type_watcher = PhabricatorObjectHasWatcherEdgeType::EDGECONST;
$member_spec = array(
$edge_action => array($viewer->getPHID() => $viewer->getPHID()),
);
@@ -46,7 +46,7 @@
$xactions = array();
$xactions[] = id(new PhabricatorProjectTransaction())
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
- ->setMetadataValue('edge:type', $type_member)
+ ->setMetadataValue('edge:type', $type_watcher)
->setNewValue($member_spec);
$editor = id(new PhabricatorProjectTransactionEditor($project))
@@ -82,6 +82,7 @@
return $this->newDialog()
->setTitle($title)
+ ->addHiddenInput('via', $via)
->appendParagraph($body)
->addCancelButton($done_uri)
->addSubmitButton($submit);
diff --git a/src/applications/project/view/PhabricatorProjectUserListView.php b/src/applications/project/view/PhabricatorProjectUserListView.php
--- a/src/applications/project/view/PhabricatorProjectUserListView.php
+++ b/src/applications/project/view/PhabricatorProjectUserListView.php
@@ -79,7 +79,7 @@
->setHref($handle->getURI())
->setImageURI($handle->getImageURI());
- if ($can_edit) {
+ if ($can_edit && !$limit) {
$remove_uri = $this->getRemoveURI($user_phid);
$item->addAction(
@@ -94,16 +94,32 @@
}
if ($user_phids) {
- $header = pht(
+ $header_text = pht(
'%s (%s)',
$this->getHeaderText(),
phutil_count($user_phids));
} else {
- $header = $this->getHeaderText();
+ $header_text = $this->getHeaderText();
+ }
+
+ $id = $project->getID();
+
+ $header = id(new PHUIHeaderView())
+ ->setHeader($header_text);
+
+ if ($limit) {
+ $header->addActionLink(
+ id(new PHUIButtonView())
+ ->setTag('a')
+ ->setIcon(
+ id(new PHUIIconView())
+ ->setIconFont('fa-list-ul'))
+ ->setText(pht('View All'))
+ ->setHref("/project/members/{$id}/"));
}
return id(new PHUIObjectBoxView())
- ->setHeaderText($header)
+ ->setHeader($header)
->setObjectList($list);
}

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 26, 2:05 PM (3 h, 14 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6929408
Default Alt Text
D15063.id36372.diff (6 KB)

Event Timeline