Make subproject/milestone watch rules work better
Summary: Ref T10349. These got sort of half-weirded-up before I separated subscriptions and watching fully. New rules are: - You can watch whatever you want. - Watching a parent watches everything inside it. - If you're watching "Stonework" and go to "Stonework > Masonry", you'll see a "Watching Ancestor" hint to let you know you're already watching a parent or ancestor. Test Plan: - Watched and unwatched "Stonework". - Watched and unwatched "Stonework > Iteration IV". - While watching "Stonework", visited "Iteration IV" and saw "Watching Ancestor" hint. - Created a task tagged "Stonework > Iteration IV". Got notified about it because I watch "Stonework". Reviewers: chad Reviewed By: chad Maniphest Tasks: T10349 Differential Revision: https://secure.phabricator.com/D15280
This commit is contained in:
@@ -162,19 +162,32 @@ final class PhabricatorProjectProfileController
|
||||
|
||||
private function renderWatchAction(PhabricatorProject $project) {
|
||||
$viewer = $this->getViewer();
|
||||
$viewer_phid = $viewer->getPHID();
|
||||
$id = $project->getID();
|
||||
|
||||
$is_watcher = ($viewer_phid && $project->isUserWatcher($viewer_phid));
|
||||
if (!$viewer->isLoggedIn()) {
|
||||
$is_watcher = false;
|
||||
$is_ancestor = false;
|
||||
} else {
|
||||
$viewer_phid = $viewer->getPHID();
|
||||
$is_watcher = $project->isUserWatcher($viewer_phid);
|
||||
$is_ancestor = $project->isUserAncestorWatcher($viewer_phid);
|
||||
}
|
||||
|
||||
if (!$is_watcher) {
|
||||
if ($is_ancestor && !$is_watcher) {
|
||||
$watch_icon = 'fa-eye';
|
||||
$watch_text = pht('Watching Ancestor');
|
||||
$watch_href = "/project/watch/{$id}/?via=profile";
|
||||
$watch_disabled = true;
|
||||
} else if (!$is_watcher) {
|
||||
$watch_icon = 'fa-eye';
|
||||
$watch_text = pht('Watch Project');
|
||||
$watch_href = "/project/watch/{$id}/?via=profile";
|
||||
$watch_disabled = false;
|
||||
} else {
|
||||
$watch_icon = 'fa-eye-slash';
|
||||
$watch_text = pht('Unwatch Project');
|
||||
$watch_href = "/project/unwatch/{$id}/?via=profile";
|
||||
$watch_disabled = false;
|
||||
}
|
||||
|
||||
$watch_icon = id(new PHUIIconView())
|
||||
@@ -185,7 +198,8 @@ final class PhabricatorProjectProfileController
|
||||
->setWorkflow(true)
|
||||
->setIcon($watch_icon)
|
||||
->setText($watch_text)
|
||||
->setHref($watch_href);
|
||||
->setHref($watch_href)
|
||||
->setDisabled($watch_disabled);
|
||||
}
|
||||
|
||||
private function buildMilestoneList(PhabricatorProject $project) {
|
||||
|
||||
Reference in New Issue
Block a user