From 7126025fe637a4d931645f05f9ad125381600755 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Wed, 1 Jun 2016 12:33:26 -0700 Subject: [PATCH] Add information dialogs to adding project members if unsupported Summary: If you try to join or add members to a parent project, we currently return 404. This instead adds an informational dialog. Fixes T11055 Test Plan: Click on Join Project and Add Members while on a Parent Project or Milestone. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T11055 Differential Revision: https://secure.phabricator.com/D16000 --- .../PhabricatorProjectMembersAddController.php | 11 ++++++++--- .../PhabricatorProjectUpdateController.php | 14 ++++++++++---- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/applications/project/controller/PhabricatorProjectMembersAddController.php b/src/applications/project/controller/PhabricatorProjectMembersAddController.php index bd1631ee92..a3b89e46fd 100644 --- a/src/applications/project/controller/PhabricatorProjectMembersAddController.php +++ b/src/applications/project/controller/PhabricatorProjectMembersAddController.php @@ -21,12 +21,17 @@ final class PhabricatorProjectMembersAddController } $this->setProject($project); + $done_uri = "/project/members/{$id}/"; if (!$project->supportsEditMembers()) { - return new Aphront404Response(); - } + $copy = pht('Parent projects and milestones do not support adding '. + 'members. You can add members directly to any non-parent subproject.'); - $done_uri = "/project/members/{$id}/"; + return $this->newDialog() + ->setTitle(pht('Unsupported Project')) + ->appendParagraph($copy) + ->addCancelButton($done_uri); + } if ($request->isFormPost()) { $member_phids = $request->getArr('memberPHIDs'); diff --git a/src/applications/project/controller/PhabricatorProjectUpdateController.php b/src/applications/project/controller/PhabricatorProjectUpdateController.php index 762343f485..9f8c204c55 100644 --- a/src/applications/project/controller/PhabricatorProjectUpdateController.php +++ b/src/applications/project/controller/PhabricatorProjectUpdateController.php @@ -32,12 +32,18 @@ final class PhabricatorProjectUpdateController return new Aphront404Response(); } - if (!$project->supportsEditMembers()) { - return new Aphront404Response(); - } - $done_uri = "/project/members/{$id}/"; + if (!$project->supportsEditMembers()) { + $copy = pht('Parent projects and milestones do not support adding '. + 'members. You can add members directly to any non-parent subproject.'); + + return $this->newDialog() + ->setTitle(pht('Unsupported Project')) + ->appendParagraph($copy) + ->addCancelButton($done_uri); + } + if ($request->isFormPost()) { $edge_action = null; switch ($action) {