@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.

Provide "Initial Members" instead of default joining projects

Summary:
Ref T10010. Instead of autojoining projects, provide "Initial Members: [___]" that the user can fill in.

This is only available in the web UI when creating a (non-milestone) project.

Test Plan:
- Created a new project with no members.
- Created a new project with some members.
- Created a new milestone (no control).
- Created a new project with myself as a member and an "Editable By: Project Members" policy, to verify this use case still works properly.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10010

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

+50 -23
+6 -22
src/applications/project/editor/PhabricatorProjectTransactionEditor.php
··· 219 219 220 220 foreach ($xactions as $xaction) { 221 221 switch ($xaction->getTransactionType()) { 222 - case PhabricatorProjectTransaction::TYPE_MEMBERS: 222 + case PhabricatorTransactions::TYPE_EDGE: 223 + $type = $xaction->getMetadataValue('edge:type'); 224 + if ($type != PhabricatorProjectProjectHasMemberEdgeType::EDGECONST) { 225 + break; 226 + } 227 + 223 228 if ($is_parent) { 224 229 $errors[] = new PhabricatorApplicationTransactionValidationError( 225 230 $xaction->getTransactionType(), ··· 791 796 $actor_phid = $actor->getPHID(); 792 797 793 798 $results = parent::expandTransactions($object, $xactions); 794 - 795 - // Automatically add the author as a member when they create a project 796 - // if they're using the web interface. 797 - 798 - $content_source = $this->getContentSource(); 799 - $source_web = PhabricatorContentSource::SOURCE_WEB; 800 - $is_web = ($content_source->getSource() === $source_web); 801 - 802 - if ($this->getIsNewObject() && $is_web) { 803 - if ($actor_phid) { 804 - $type_member = PhabricatorProjectProjectHasMemberEdgeType::EDGECONST; 805 - 806 - $results[] = id(new PhabricatorProjectTransaction()) 807 - ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) 808 - ->setMetadataValue('edge:type', $type_member) 809 - ->setNewValue( 810 - array( 811 - '+' => array($actor_phid => $actor_phid), 812 - )); 813 - } 814 - } 815 799 816 800 $is_milestone = $object->isMilestone(); 817 801 foreach ($xactions as $xaction) {
+44 -1
src/applications/project/engine/PhabricatorProjectEditEngine.php
··· 176 176 $milestone_phid = null; 177 177 } 178 178 179 - return array( 179 + $fields = array( 180 180 id(new PhabricatorHandlesEditField()) 181 181 ->setKey('parent') 182 182 ->setLabel(pht('Parent')) ··· 243 243 ->setConduitTypeDescription(pht('New list of slugs.')) 244 244 ->setValue($slugs), 245 245 ); 246 + 247 + $can_edit_members = (!$milestone) && 248 + (!$object->isMilestone()) && 249 + (!$object->getHasSubprojects()); 250 + 251 + if ($can_edit_members) { 252 + 253 + // Show this on the web UI when creating a project, but not when editing 254 + // one. It is always available via Conduit. 255 + $conduit_only = !$this->getIsCreate(); 256 + 257 + $members_field = id(new PhabricatorUsersEditField()) 258 + ->setKey('members') 259 + ->setAliases(array('memberPHIDs')) 260 + ->setLabel(pht('Initial Members')) 261 + ->setIsConduitOnly($conduit_only) 262 + ->setUseEdgeTransactions(true) 263 + ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) 264 + ->setMetadataValue( 265 + 'edge:type', 266 + PhabricatorProjectProjectHasMemberEdgeType::EDGECONST) 267 + ->setDescription(pht('Initial project members.')) 268 + ->setConduitDescription(pht('Set project members.')) 269 + ->setConduitTypeDescription(pht('New list of members.')) 270 + ->setValue(array()); 271 + 272 + $members_field->setViewer($this->getViewer()); 273 + 274 + $edit_add = $members_field->getConduitEditType('members.add') 275 + ->setConduitDescription(pht('Add members.')); 276 + 277 + $edit_set = $members_field->getConduitEditType('members.set') 278 + ->setConduitDescription( 279 + pht('Set members, overwriting the current value.')); 280 + 281 + $edit_rem = $members_field->getConduitEditType('members.remove') 282 + ->setConduitDescription(pht('Remove members.')); 283 + 284 + $fields[] = $members_field; 285 + } 286 + 287 + return $fields; 288 + 246 289 } 247 290 248 291 }