@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Check if user can create project before showing shortcut

Summary: In Maniphest, we provide an additional caption shortcut if you can create projects, which has no use if you cant. Fixes T6969

Test Plan: Check page with and without a user's capability.

Reviewers: btrahan, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T6969

Differential Revision: https://secure.phabricator.com/D11390

+16 -9
+16 -9
src/applications/maniphest/controller/ManiphestTaskEditController.php
··· 25 25 ManiphestEditProjectsCapability::CAPABILITY); 26 26 $can_edit_status = $this->hasApplicationCapability( 27 27 ManiphestEditStatusCapability::CAPABILITY); 28 + $can_create_projects = PhabricatorPolicyFilter::hasCapability( 29 + $user, 30 + PhabricatorApplication::getByClass('PhabricatorProjectApplication'), 31 + ProjectCreateProjectsCapability::CAPABILITY); 28 32 29 33 $parent_task = null; 30 34 $template_id = null; ··· 664 668 } 665 669 666 670 if ($can_edit_projects) { 671 + $caption = null; 672 + if ($can_create_projects) { 673 + $caption = javelin_tag( 674 + 'a', 675 + array( 676 + 'href' => '/project/create/', 677 + 'mustcapture' => true, 678 + 'sigil' => 'project-create', 679 + ), 680 + pht('Create New Project')); 681 + } 667 682 $form 668 683 ->appendChild( 669 684 id(new AphrontFormTokenizerControl()) ··· 671 686 ->setName('projects') 672 687 ->setValue($projects_value) 673 688 ->setID($project_tokenizer_id) 674 - ->setCaption( 675 - javelin_tag( 676 - 'a', 677 - array( 678 - 'href' => '/project/create/', 679 - 'mustcapture' => true, 680 - 'sigil' => 'project-create', 681 - ), 682 - pht('Create New Project'))) 689 + ->setCaption($caption) 683 690 ->setDatasource(new PhabricatorProjectDatasource())); 684 691 } 685 692