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

Unbreak the creation of Packages Versions

Summary:
Allow the creation of versions in Packages
by specifying a dummy Package to allow the
extended policy checks to pass. Versions
require that the package they're a version
of be accessible to the viewer, but that
means a package is required during creation.

This also initializes the attached package
property to the un-attached state, which
was missing. This should make it easier to
fix when misused.

Currently trying to create versions in Packages throws:
```
EXCEPTION: (Error) Call to a member function getPHID() on null at [<phorge>/src/applications/policy/filter/PhabricatorPolicyFilter.php:404]
```

Test Plan:
* Visit /applications/view/PhabricatorPackagesApplication/ and enable the Packages prototype application
* Visit /packages/version/edit/form/default
* Observe an edit form instead of an exception

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

Subscribers: aklapper, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25882

+6 -2
+5 -1
src/applications/packages/editor/PhabricatorPackagesVersionEditEngine.php
··· 19 19 20 20 protected function newEditableObject() { 21 21 $viewer = $this->getViewer(); 22 - return PhabricatorPackagesVersion::initializeNewVersion($viewer); 22 + return PhabricatorPackagesVersion::initializeNewVersion($viewer) 23 + // Attach a dummy package to have the policy checks pass for this object 24 + // during creation. 25 + ->attachPackage( 26 + PhabricatorPackagesPackage::initializeNewPackage($viewer)); 23 27 } 24 28 25 29 protected function newObjectQuery() {
+1 -1
src/applications/packages/storage/PhabricatorPackagesVersion.php
··· 15 15 protected $name; 16 16 protected $packagePHID; 17 17 18 - private $package; 18 + private $package = self::ATTACHABLE; 19 19 20 20 public static function initializeNewVersion(PhabricatorUser $actor) { 21 21 return id(new self());