From 5c2e49a81223368aab906fafd47087432ac9f740 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 19 Jan 2016 17:43:14 -0800 Subject: [PATCH] Allow any user to watch any project they can see Summary: Ref T6183. Ref T10054. Historically, only members could watch projects because there were some weird special cases with policies. These policy issues have been resolved and Herald is generally powerful enough to do equivalent watches on most objects anyway. Also puts a "Watch Project" button on the feed panel to make the behavior and meaning more obvious. Test Plan: - Watched a project I was not a member of. - Clicked the feed watch/unwatch button. {F1064909} Reviewers: chad Reviewed By: chad Maniphest Tasks: T6183, T10054 Differential Revision: https://secure.phabricator.com/D15063 --- .../badges/storage/PhabricatorBadgesBadge.php | 4 -- .../storage/PhabricatorCalendarEvent.php | 4 -- .../storage/PhabricatorCountdown.php | 4 -- .../storage/DifferentialRevision.php | 4 -- .../files/storage/PhabricatorFile.php | 4 -- .../fund/storage/FundInitiative.php | 4 -- .../configuration/HarbormasterBuildPlan.php | 4 -- .../herald/storage/HeraldRule.php | 4 -- .../legalpad/storage/LegalpadDocument.php | 4 -- .../storage/PhabricatorFileImageMacro.php | 4 -- .../maniphest/storage/ManiphestTask.php | 4 -- .../storage/PassphraseCredential.php | 4 -- .../paste/storage/PhabricatorPaste.php | 4 -- src/applications/phame/storage/PhameBlog.php | 4 -- src/applications/phame/storage/PhamePost.php | 4 -- .../pholio/storage/PholioMock.php | 4 -- .../phriction/storage/PhrictionDocument.php | 4 -- .../phurl/storage/PhabricatorPhurlURL.php | 4 -- .../ponder/storage/PonderAnswer.php | 4 -- .../ponder/storage/PonderQuestion.php | 4 -- ...habricatorProjectMembersViewController.php | 30 +++++++-------- .../PhabricatorProjectProfileController.php | 37 ++++++++++++++++++- .../PhabricatorProjectWatchController.php | 15 ++++---- .../PhabricatorProjectTransactionEditor.php | 34 ++++------------- .../project/storage/PhabricatorProject.php | 5 --- .../view/PhabricatorProjectUserListView.php | 24 ++++++++++-- .../storage/PhabricatorRepositoryCommit.php | 4 -- .../storage/PhabricatorSlowvotePoll.php | 4 -- ...PhabricatorSubscriptionsEditController.php | 7 ---- ...habricatorSubscriptionsUIEventListener.php | 5 --- .../PhabricatorSubscribableInterface.php | 15 -------- .../storage/PhabricatorWorkerBulkJob.php | 4 -- 32 files changed, 87 insertions(+), 177 deletions(-) diff --git a/src/applications/badges/storage/PhabricatorBadgesBadge.php b/src/applications/badges/storage/PhabricatorBadgesBadge.php index 29cccb9f44..254b02a6eb 100644 --- a/src/applications/badges/storage/PhabricatorBadgesBadge.php +++ b/src/applications/badges/storage/PhabricatorBadgesBadge.php @@ -185,10 +185,6 @@ final class PhabricatorBadgesBadge extends PhabricatorBadgesDAO return true; } - public function shouldAllowSubscription($phid) { - return true; - } - /* -( PhabricatorTokenReceiverInterface )---------------------------------- */ diff --git a/src/applications/calendar/storage/PhabricatorCalendarEvent.php b/src/applications/calendar/storage/PhabricatorCalendarEvent.php index 1b4c1a760c..36aa905b3e 100644 --- a/src/applications/calendar/storage/PhabricatorCalendarEvent.php +++ b/src/applications/calendar/storage/PhabricatorCalendarEvent.php @@ -535,10 +535,6 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO return true; } - public function shouldAllowSubscription($phid) { - return true; - } - /* -( PhabricatorTokenReceiverInterface )---------------------------------- */ diff --git a/src/applications/countdown/storage/PhabricatorCountdown.php b/src/applications/countdown/storage/PhabricatorCountdown.php index 8753c66223..1a864907eb 100644 --- a/src/applications/countdown/storage/PhabricatorCountdown.php +++ b/src/applications/countdown/storage/PhabricatorCountdown.php @@ -74,10 +74,6 @@ final class PhabricatorCountdown extends PhabricatorCountdownDAO return true; } - public function shouldAllowSubscription($phid) { - return true; - } - /* -( PhabricatorApplicationTransactionInterface )------------------------- */ diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php index e534ad9ca7..ff72b46de7 100644 --- a/src/applications/differential/storage/DifferentialRevision.php +++ b/src/applications/differential/storage/DifferentialRevision.php @@ -485,10 +485,6 @@ final class DifferentialRevision extends DifferentialDAO return true; } - public function shouldAllowSubscription($phid) { - return true; - } - /* -( PhabricatorCustomFieldInterface )------------------------------------ */ diff --git a/src/applications/files/storage/PhabricatorFile.php b/src/applications/files/storage/PhabricatorFile.php index 92dd0bcf88..7d2780778f 100644 --- a/src/applications/files/storage/PhabricatorFile.php +++ b/src/applications/files/storage/PhabricatorFile.php @@ -1352,10 +1352,6 @@ final class PhabricatorFile extends PhabricatorFileDAO return true; } - public function shouldAllowSubscription($phid) { - return true; - } - /* -( PhabricatorTokenReceiverInterface )---------------------------------- */ diff --git a/src/applications/fund/storage/FundInitiative.php b/src/applications/fund/storage/FundInitiative.php index 57e86beccf..3375551443 100644 --- a/src/applications/fund/storage/FundInitiative.php +++ b/src/applications/fund/storage/FundInitiative.php @@ -182,10 +182,6 @@ final class FundInitiative extends FundDAO return true; } - public function shouldAllowSubscription($phid) { - return true; - } - /* -( PhabricatorTokenRecevierInterface )---------------------------------- */ diff --git a/src/applications/harbormaster/storage/configuration/HarbormasterBuildPlan.php b/src/applications/harbormaster/storage/configuration/HarbormasterBuildPlan.php index 11cb6260b7..5ac9696813 100644 --- a/src/applications/harbormaster/storage/configuration/HarbormasterBuildPlan.php +++ b/src/applications/harbormaster/storage/configuration/HarbormasterBuildPlan.php @@ -129,10 +129,6 @@ final class HarbormasterBuildPlan extends HarbormasterDAO return true; } - public function shouldAllowSubscription($phid) { - return true; - } - /* -( PhabricatorApplicationTransactionInterface )------------------------- */ diff --git a/src/applications/herald/storage/HeraldRule.php b/src/applications/herald/storage/HeraldRule.php index 51707fcc8a..8d585263c0 100644 --- a/src/applications/herald/storage/HeraldRule.php +++ b/src/applications/herald/storage/HeraldRule.php @@ -332,10 +332,6 @@ final class HeraldRule extends HeraldDAO return true; } - public function shouldAllowSubscription($phid) { - return true; - } - /* -( PhabricatorDestructibleInterface )----------------------------------- */ diff --git a/src/applications/legalpad/storage/LegalpadDocument.php b/src/applications/legalpad/storage/LegalpadDocument.php index 4c6e04a26a..51f158a978 100644 --- a/src/applications/legalpad/storage/LegalpadDocument.php +++ b/src/applications/legalpad/storage/LegalpadDocument.php @@ -167,10 +167,6 @@ final class LegalpadDocument extends LegalpadDAO return true; } - public function shouldAllowSubscription($phid) { - return true; - } - /* -( PhabricatorPolicyInterface )----------------------------------------- */ diff --git a/src/applications/macro/storage/PhabricatorFileImageMacro.php b/src/applications/macro/storage/PhabricatorFileImageMacro.php index 72a6577924..5cf23133a3 100644 --- a/src/applications/macro/storage/PhabricatorFileImageMacro.php +++ b/src/applications/macro/storage/PhabricatorFileImageMacro.php @@ -115,10 +115,6 @@ final class PhabricatorFileImageMacro extends PhabricatorFileDAO return true; } - public function shouldAllowSubscription($phid) { - return true; - } - /* -( PhabricatorTokenRecevierInterface )---------------------------------- */ diff --git a/src/applications/maniphest/storage/ManiphestTask.php b/src/applications/maniphest/storage/ManiphestTask.php index 9f8dad1cd8..cc9a5bd80a 100644 --- a/src/applications/maniphest/storage/ManiphestTask.php +++ b/src/applications/maniphest/storage/ManiphestTask.php @@ -227,10 +227,6 @@ final class ManiphestTask extends ManiphestDAO return true; } - public function shouldAllowSubscription($phid) { - return true; - } - /* -( Markup Interface )--------------------------------------------------- */ diff --git a/src/applications/passphrase/storage/PassphraseCredential.php b/src/applications/passphrase/storage/PassphraseCredential.php index 4d705aff83..f263523b49 100644 --- a/src/applications/passphrase/storage/PassphraseCredential.php +++ b/src/applications/passphrase/storage/PassphraseCredential.php @@ -161,10 +161,6 @@ final class PassphraseCredential extends PassphraseDAO return true; } - public function shouldAllowSubscription($phid) { - return true; - } - /* -( PhabricatorDestructibleInterface )----------------------------------- */ diff --git a/src/applications/paste/storage/PhabricatorPaste.php b/src/applications/paste/storage/PhabricatorPaste.php index 022b998bac..624c70c410 100644 --- a/src/applications/paste/storage/PhabricatorPaste.php +++ b/src/applications/paste/storage/PhabricatorPaste.php @@ -159,10 +159,6 @@ final class PhabricatorPaste extends PhabricatorPasteDAO return true; } - public function shouldAllowSubscription($phid) { - return true; - } - /* -( PhabricatorTokenReceiverInterface )---------------------------------- */ diff --git a/src/applications/phame/storage/PhameBlog.php b/src/applications/phame/storage/PhameBlog.php index 5b5b128ae6..d9b9bdb41d 100644 --- a/src/applications/phame/storage/PhameBlog.php +++ b/src/applications/phame/storage/PhameBlog.php @@ -340,10 +340,6 @@ final class PhameBlog extends PhameDAO return true; } - public function shouldAllowSubscription($phid) { - return true; - } - /* -( PhabricatorConduitResultInterface )---------------------------------- */ diff --git a/src/applications/phame/storage/PhamePost.php b/src/applications/phame/storage/PhamePost.php index 57519bd2f1..01dd71e88d 100644 --- a/src/applications/phame/storage/PhamePost.php +++ b/src/applications/phame/storage/PhamePost.php @@ -286,10 +286,6 @@ final class PhamePost extends PhameDAO return true; } - public function shouldAllowSubscription($phid) { - return true; - } - /* -( PhabricatorConduitResultInterface )---------------------------------- */ diff --git a/src/applications/pholio/storage/PholioMock.php b/src/applications/pholio/storage/PholioMock.php index 6316d92cb9..c817b7f32b 100644 --- a/src/applications/pholio/storage/PholioMock.php +++ b/src/applications/pholio/storage/PholioMock.php @@ -188,10 +188,6 @@ final class PholioMock extends PholioDAO return true; } - public function shouldAllowSubscription($phid) { - return true; - } - /* -( PhabricatorPolicyInterface Implementation )-------------------------- */ diff --git a/src/applications/phriction/storage/PhrictionDocument.php b/src/applications/phriction/storage/PhrictionDocument.php index 3c883625b0..915cfed1eb 100644 --- a/src/applications/phriction/storage/PhrictionDocument.php +++ b/src/applications/phriction/storage/PhrictionDocument.php @@ -198,10 +198,6 @@ final class PhrictionDocument extends PhrictionDAO return true; } - public function shouldAllowSubscription($phid) { - return true; - } - /* -( PhabricatorApplicationTransactionInterface )------------------------- */ diff --git a/src/applications/phurl/storage/PhabricatorPhurlURL.php b/src/applications/phurl/storage/PhabricatorPhurlURL.php index 7df1d241a7..30a3b0b93b 100644 --- a/src/applications/phurl/storage/PhabricatorPhurlURL.php +++ b/src/applications/phurl/storage/PhabricatorPhurlURL.php @@ -173,10 +173,6 @@ final class PhabricatorPhurlURL extends PhabricatorPhurlDAO return true; } - public function shouldAllowSubscription($phid) { - return true; - } - /* -( PhabricatorTokenReceiverInterface )---------------------------------- */ diff --git a/src/applications/ponder/storage/PonderAnswer.php b/src/applications/ponder/storage/PonderAnswer.php index 722fee8eec..4da222d5a5 100644 --- a/src/applications/ponder/storage/PonderAnswer.php +++ b/src/applications/ponder/storage/PonderAnswer.php @@ -253,10 +253,6 @@ final class PonderAnswer extends PonderDAO return true; } - public function shouldAllowSubscription($phid) { - return true; - } - /* -( PhabricatorDestructibleInterface )----------------------------------- */ diff --git a/src/applications/ponder/storage/PonderQuestion.php b/src/applications/ponder/storage/PonderQuestion.php index bbce081d88..5ab719e3ac 100644 --- a/src/applications/ponder/storage/PonderQuestion.php +++ b/src/applications/ponder/storage/PonderQuestion.php @@ -252,10 +252,6 @@ final class PonderQuestion extends PonderDAO return true; } - public function shouldAllowSubscription($phid) { - return true; - } - /* -( PhabricatorTokenReceiverInterface )---------------------------------- */ diff --git a/src/applications/project/controller/PhabricatorProjectMembersViewController.php b/src/applications/project/controller/PhabricatorProjectMembersViewController.php index dd9f263e5d..9189b1ad8d 100644 --- a/src/applications/project/controller/PhabricatorProjectMembersViewController.php +++ b/src/applications/project/controller/PhabricatorProjectMembersViewController.php @@ -152,22 +152,22 @@ final class PhabricatorProjectMembersViewController ->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 index 9bb694d9ba..721193c469 100644 --- a/src/applications/project/controller/PhabricatorProjectProfileController.php +++ b/src/applications/project/controller/PhabricatorProjectProfileController.php @@ -52,6 +52,7 @@ final class PhabricatorProjectProfileController $nav = $this->getProfileMenu(); $nav->selectFilter(PhabricatorProject::PANEL_PROFILE); + $watch_action = $this->renderWatchAction($project); $stories = id(new PhabricatorFeedQuery()) ->setViewer($viewer) @@ -62,10 +63,15 @@ final class PhabricatorProjectProfileController ->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 @@ final class PhabricatorProjectProfileController 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 index c39e7dd510..d8b818cb63 100644 --- a/src/applications/project/controller/PhabricatorProjectWatchController.php +++ b/src/applications/project/controller/PhabricatorProjectWatchController.php @@ -18,11 +18,11 @@ final class PhabricatorProjectWatchController 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 @@ final class PhabricatorProjectWatchController break; } - $type_member = PhabricatorObjectHasWatcherEdgeType::EDGECONST; + $type_watcher = PhabricatorObjectHasWatcherEdgeType::EDGECONST; $member_spec = array( $edge_action => array($viewer->getPHID() => $viewer->getPHID()), ); @@ -46,7 +46,7 @@ final class PhabricatorProjectWatchController $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 @@ final class PhabricatorProjectWatchController return $this->newDialog() ->setTitle($title) + ->addHiddenInput('via', $via) ->appendParagraph($body) ->addCancelButton($done_uri) ->addSubmitButton($submit); diff --git a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php index 215db165ae..ef3f165356 100644 --- a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php +++ b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php @@ -188,21 +188,18 @@ final class PhabricatorProjectTransactionEditor switch ($edge_type) { case PhabricatorProjectProjectHasMemberEdgeType::EDGECONST: case PhabricatorObjectHasWatcherEdgeType::EDGECONST: + $edge_const = PhabricatorProjectProjectHasMemberEdgeType::EDGECONST; + if ($edge_type != $edge_const) { + break; + } + $old = $xaction->getOldValue(); $new = $xaction->getNewValue(); - // When adding members or watchers, we add subscriptions. + // When adding members, we add subscriptions. When removing + // members, we remove subscriptions. $add = array_keys(array_diff_key($new, $old)); - - // When removing members, we remove their subscription too. - // When unwatching, we leave subscriptions, since it's fine to be - // subscribed to a project but not be a member of it. - $edge_const = PhabricatorProjectProjectHasMemberEdgeType::EDGECONST; - if ($edge_type == $edge_const) { - $rem = array_keys(array_diff_key($old, $new)); - } else { - $rem = array(); - } + $rem = array_keys(array_diff_key($old, $new)); // NOTE: The subscribe is "explicit" because there's no implicit // unsubscribe, so Join -> Leave -> Join doesn't resubscribe you @@ -212,27 +209,12 @@ final class PhabricatorProjectTransactionEditor // this, which is a fairly weird edge case and pretty arguable both // ways. - // Subscriptions caused by watches should also clearly be explicit, - // and that case is unambiguous. - id(new PhabricatorSubscriptionsEditor()) ->setActor($this->requireActor()) ->setObject($object) ->subscribeExplicit($add) ->unsubscribe($rem) ->save(); - - if ($rem) { - // When removing members, also remove any watches on the project. - $edge_editor = new PhabricatorEdgeEditor(); - foreach ($rem as $rem_phid) { - $edge_editor->removeEdge( - $object->getPHID(), - PhabricatorObjectHasWatcherEdgeType::EDGECONST, - $rem_phid); - } - $edge_editor->save(); - } break; } break; diff --git a/src/applications/project/storage/PhabricatorProject.php b/src/applications/project/storage/PhabricatorProject.php index ceaac1a16d..2ea3a2c131 100644 --- a/src/applications/project/storage/PhabricatorProject.php +++ b/src/applications/project/storage/PhabricatorProject.php @@ -548,11 +548,6 @@ final class PhabricatorProject extends PhabricatorProjectDAO return false; } - public function shouldAllowSubscription($phid) { - return $this->isUserMember($phid) && - !$this->isUserWatcher($phid); - } - /* -( PhabricatorCustomFieldInterface )------------------------------------ */ diff --git a/src/applications/project/view/PhabricatorProjectUserListView.php b/src/applications/project/view/PhabricatorProjectUserListView.php index f93b9da695..138d51cbf3 100644 --- a/src/applications/project/view/PhabricatorProjectUserListView.php +++ b/src/applications/project/view/PhabricatorProjectUserListView.php @@ -79,7 +79,7 @@ abstract class PhabricatorProjectUserListView extends AphrontView { ->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 @@ abstract class PhabricatorProjectUserListView extends AphrontView { } 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); } diff --git a/src/applications/repository/storage/PhabricatorRepositoryCommit.php b/src/applications/repository/storage/PhabricatorRepositoryCommit.php index fc67d8b7b3..348b94d021 100644 --- a/src/applications/repository/storage/PhabricatorRepositoryCommit.php +++ b/src/applications/repository/storage/PhabricatorRepositoryCommit.php @@ -443,10 +443,6 @@ final class PhabricatorRepositoryCommit return true; } - public function shouldAllowSubscription($phid) { - return true; - } - /* -( PhabricatorApplicationTransactionInterface )------------------------- */ diff --git a/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php b/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php index 12f4f9e984..2240c510aa 100644 --- a/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php +++ b/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php @@ -183,10 +183,6 @@ final class PhabricatorSlowvotePoll extends PhabricatorSlowvoteDAO return true; } - public function shouldAllowSubscription($phid) { - return true; - } - /* -( PhabricatorTokenReceiverInterface )---------------------------------- */ diff --git a/src/applications/subscriptions/controller/PhabricatorSubscriptionsEditController.php b/src/applications/subscriptions/controller/PhabricatorSubscriptionsEditController.php index 3723a755be..ad089d8f3d 100644 --- a/src/applications/subscriptions/controller/PhabricatorSubscriptionsEditController.php +++ b/src/applications/subscriptions/controller/PhabricatorSubscriptionsEditController.php @@ -61,13 +61,6 @@ final class PhabricatorSubscriptionsEditController $handle->getURI()); } - if (!$object->shouldAllowSubscription($viewer->getPHID())) { - return $this->buildErrorResponse( - pht('You Can Not Subscribe'), - pht('You can not subscribe to this object.'), - $handle->getURI()); - } - if ($object instanceof PhabricatorApplicationTransactionInterface) { if ($is_add) { $xaction_value = array( diff --git a/src/applications/subscriptions/events/PhabricatorSubscriptionsUIEventListener.php b/src/applications/subscriptions/events/PhabricatorSubscriptionsUIEventListener.php index fb7c32892f..b69ce4243f 100644 --- a/src/applications/subscriptions/events/PhabricatorSubscriptionsUIEventListener.php +++ b/src/applications/subscriptions/events/PhabricatorSubscriptionsUIEventListener.php @@ -34,11 +34,6 @@ final class PhabricatorSubscriptionsUIEventListener return; } - if (!$object->shouldAllowSubscription($user_phid)) { - // This object doesn't allow the viewer to subscribe. - return; - } - if ($user_phid && $object->isAutomaticallySubscribed($user_phid)) { $sub_action = id(new PhabricatorActionView()) ->setWorkflow(true) diff --git a/src/applications/subscriptions/interface/PhabricatorSubscribableInterface.php b/src/applications/subscriptions/interface/PhabricatorSubscribableInterface.php index 95275e53bb..e54e2cd42e 100644 --- a/src/applications/subscriptions/interface/PhabricatorSubscribableInterface.php +++ b/src/applications/subscriptions/interface/PhabricatorSubscribableInterface.php @@ -22,17 +22,6 @@ interface PhabricatorSubscribableInterface { */ public function shouldShowSubscribersProperty(); - - /** - * Return `true` to indicate that the "Subscribe" action should be shown and - * enabled when rendering action lists for this object, or `false` to omit - * the action. - * - * @param phid Viewing or acting user PHID. - * @return bool True to allow the user to subscribe. - */ - public function shouldAllowSubscription($phid); - } // TEMPLATE IMPLEMENTATION ///////////////////////////////////////////////////// @@ -48,8 +37,4 @@ interface PhabricatorSubscribableInterface { return true; } - public function shouldAllowSubscription($phid) { - return true; - } - */ diff --git a/src/infrastructure/daemon/workers/storage/PhabricatorWorkerBulkJob.php b/src/infrastructure/daemon/workers/storage/PhabricatorWorkerBulkJob.php index 20d981c576..0b70268cb4 100644 --- a/src/infrastructure/daemon/workers/storage/PhabricatorWorkerBulkJob.php +++ b/src/infrastructure/daemon/workers/storage/PhabricatorWorkerBulkJob.php @@ -222,10 +222,6 @@ final class PhabricatorWorkerBulkJob return true; } - public function shouldAllowSubscription($phid) { - return true; - } - /* -( PhabricatorApplicationTransactionInterface )------------------------- */