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

Fix a handful of Nuance fatals

Summary: Ref T12738. Some of the Nuance "form" workflows currently fatal after work on the GitHub stuff. Try to make everything stop fataling, at least.

Test Plan: Using "Complaints Form" no longer fatals, and now lodges a complaint instead.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12738

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

+38 -11
+2
resources/sql/autopatches/20170522.nuance.01.itemkey.sql
··· 1 + ALTER TABLE {$NAMESPACE}_nuance.nuance_item 2 + MODIFY itemKey VARCHAR(64) COLLATE {$COLLATE_TEXT};
+2
src/__phutil_library_map__.php
··· 1606 1606 'NuanceContentSource' => 'applications/nuance/contentsource/NuanceContentSource.php', 1607 1607 'NuanceController' => 'applications/nuance/controller/NuanceController.php', 1608 1608 'NuanceDAO' => 'applications/nuance/storage/NuanceDAO.php', 1609 + 'NuanceFormItemType' => 'applications/nuance/item/NuanceFormItemType.php', 1609 1610 'NuanceGitHubEventItemType' => 'applications/nuance/item/NuanceGitHubEventItemType.php', 1610 1611 'NuanceGitHubImportCursor' => 'applications/nuance/cursor/NuanceGitHubImportCursor.php', 1611 1612 'NuanceGitHubIssuesImportCursor' => 'applications/nuance/cursor/NuanceGitHubIssuesImportCursor.php', ··· 6716 6717 'NuanceContentSource' => 'PhabricatorContentSource', 6717 6718 'NuanceController' => 'PhabricatorController', 6718 6719 'NuanceDAO' => 'PhabricatorLiskDAO', 6720 + 'NuanceFormItemType' => 'NuanceItemType', 6719 6721 'NuanceGitHubEventItemType' => 'NuanceItemType', 6720 6722 'NuanceGitHubImportCursor' => 'NuanceImportCursor', 6721 6723 'NuanceGitHubIssuesImportCursor' => 'NuanceGitHubImportCursor',
+1 -2
src/applications/nuance/cursor/NuanceGitHubIssuesImportCursor.php
··· 17 17 18 18 $container_key = null; 19 19 20 - return NuanceItem::initializeNewItem() 20 + return NuanceItem::initializeNewItem(NuanceGitHubEventItemType::ITEMTYPE) 21 21 ->setStatus(NuanceItem::STATUS_IMPORTING) 22 22 ->setSourcePHID($source->getPHID()) 23 - ->setItemType(NuanceGitHubEventItemType::ITEMTYPE) 24 23 ->setItemKey($item_key) 25 24 ->setItemContainerKey($container_key) 26 25 ->setItemProperty('api.type', 'issue')
+1 -2
src/applications/nuance/cursor/NuanceGitHubRepositoryImportCursor.php
··· 36 36 $container_key = "github.issue.{$issue_id}"; 37 37 } 38 38 39 - return NuanceItem::initializeNewItem() 39 + return NuanceItem::initializeNewItem(NuanceGitHubEventItemType::ITEMTYPE) 40 40 ->setStatus(NuanceItem::STATUS_IMPORTING) 41 41 ->setSourcePHID($source->getPHID()) 42 - ->setItemType(NuanceGitHubEventItemType::ITEMTYPE) 43 42 ->setItemKey($item_key) 44 43 ->setItemContainerKey($container_key) 45 44 ->setItemProperty('api.type', 'repository')
+16
src/applications/nuance/item/NuanceFormItemType.php
··· 1 + <?php 2 + 3 + final class NuanceFormItemType 4 + extends NuanceItemType { 5 + 6 + const ITEMTYPE = 'form.item'; 7 + 8 + public function getItemTypeDisplayName() { 9 + return pht('Form'); 10 + } 11 + 12 + public function getItemDisplayName(NuanceItem $item) { 13 + return pht('Complaint'); 14 + } 15 + 16 + }
+1 -1
src/applications/nuance/phid/NuanceItemPHIDType.php
··· 33 33 foreach ($handles as $phid => $handle) { 34 34 $item = $objects[$phid]; 35 35 36 - $handle->setName($item->getItemDisplayName()); 36 + $handle->setName($item->getDisplayName()); 37 37 $handle->setURI($item->getURI()); 38 38 } 39 39 }
+3 -1
src/applications/nuance/source/NuancePhabricatorFormSourceDefinition.php
··· 39 39 $content_source = PhabricatorContentSource::newFromRequest($request); 40 40 41 41 $item = $this->newItemFromProperties( 42 + NuanceFormItemType::ITEMTYPE, 43 + $viewer->getPHID(), 42 44 $properties, 43 45 $content_source); 44 46 ··· 79 81 NuanceItem $item, 80 82 PHUIPropertyListView $view) { 81 83 82 - $complaint = $item->getNuanceProperty('complaint'); 84 + $complaint = $item->getItemProperty('complaint'); 83 85 $complaint = new PHUIRemarkupView($viewer, $complaint); 84 86 $view->addSectionHeader( 85 87 pht('Complaint'), 'fa-exclamation-circle');
+4 -1
src/applications/nuance/source/NuanceSourceDefinition.php
··· 149 149 } 150 150 151 151 protected function newItemFromProperties( 152 + $item_type, 153 + $author_phid, 152 154 array $properties, 153 155 PhabricatorContentSource $content_source) { 154 156 ··· 157 159 $actor = PhabricatorUser::getOmnipotentUser(); 158 160 $source = $this->getSource(); 159 161 160 - $item = NuanceItem::initializeNewItem(); 162 + $item = NuanceItem::initializeNewItem($item_type); 161 163 162 164 $xactions = array(); 163 165 ··· 181 183 182 184 $editor = id(new NuanceItemEditor()) 183 185 ->setActor($actor) 186 + ->setActingAsPHID($author_phid) 184 187 ->setContentSource($content_source); 185 188 186 189 $editor->applyTransactions($item, $xactions);
+6 -2
src/applications/nuance/storage/NuanceItem.php
··· 26 26 private $source = self::ATTACHABLE; 27 27 private $implementation = self::ATTACHABLE; 28 28 29 - public static function initializeNewItem() { 29 + public static function initializeNewItem($item_type) { 30 + 31 + // TODO: Validate that the type is valid, and construct and attach it. 32 + 30 33 return id(new NuanceItem()) 34 + ->setItemType($item_type) 31 35 ->setStatus(self::STATUS_OPEN); 32 36 } 33 37 ··· 42 46 'requestorPHID' => 'phid?', 43 47 'queuePHID' => 'phid?', 44 48 'itemType' => 'text64', 45 - 'itemKey' => 'text64', 49 + 'itemKey' => 'text64?', 46 50 'itemContainerKey' => 'text64?', 47 51 'status' => 'text32', 48 52 'mailKey' => 'bytes20',
+2 -2
src/applications/nuance/xaction/NuanceItemPropertyTransaction.php
··· 8 8 public function generateOldValue($object) { 9 9 $property_key = NuanceItemTransaction::PROPERTY_KEY; 10 10 $key = $this->getMetadataValue($property_key); 11 - return $object->getNuanceProperty($key); 11 + return $object->getItemProperty($key); 12 12 } 13 13 14 14 public function applyInternalEffects($object, $value) { 15 15 $property_key = NuanceItemTransaction::PROPERTY_KEY; 16 16 $key = $this->getMetadataValue($property_key); 17 17 18 - $object->setNuanceProperty($key, $value); 18 + $object->setItemProperty($key, $value); 19 19 } 20 20 21 21 public function getTitle() {