Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13989496
D18007.id43310.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D18007.id43310.diff
View Options
diff --git a/resources/sql/autopatches/20170522.nuance.01.itemkey.sql b/resources/sql/autopatches/20170522.nuance.01.itemkey.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20170522.nuance.01.itemkey.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_nuance.nuance_item
+ MODIFY itemKey VARCHAR(64) COLLATE {$COLLATE_TEXT};
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1605,6 +1605,7 @@
'NuanceContentSource' => 'applications/nuance/contentsource/NuanceContentSource.php',
'NuanceController' => 'applications/nuance/controller/NuanceController.php',
'NuanceDAO' => 'applications/nuance/storage/NuanceDAO.php',
+ 'NuanceFormItemType' => 'applications/nuance/item/NuanceFormItemType.php',
'NuanceGitHubEventItemType' => 'applications/nuance/item/NuanceGitHubEventItemType.php',
'NuanceGitHubImportCursor' => 'applications/nuance/cursor/NuanceGitHubImportCursor.php',
'NuanceGitHubIssuesImportCursor' => 'applications/nuance/cursor/NuanceGitHubIssuesImportCursor.php',
@@ -6707,6 +6708,7 @@
'NuanceContentSource' => 'PhabricatorContentSource',
'NuanceController' => 'PhabricatorController',
'NuanceDAO' => 'PhabricatorLiskDAO',
+ 'NuanceFormItemType' => 'NuanceItemType',
'NuanceGitHubEventItemType' => 'NuanceItemType',
'NuanceGitHubImportCursor' => 'NuanceImportCursor',
'NuanceGitHubIssuesImportCursor' => 'NuanceGitHubImportCursor',
diff --git a/src/applications/nuance/cursor/NuanceGitHubIssuesImportCursor.php b/src/applications/nuance/cursor/NuanceGitHubIssuesImportCursor.php
--- a/src/applications/nuance/cursor/NuanceGitHubIssuesImportCursor.php
+++ b/src/applications/nuance/cursor/NuanceGitHubIssuesImportCursor.php
@@ -17,10 +17,9 @@
$container_key = null;
- return NuanceItem::initializeNewItem()
+ return NuanceItem::initializeNewItem(NuanceGitHubEventItemType::ITEMTYPE)
->setStatus(NuanceItem::STATUS_IMPORTING)
->setSourcePHID($source->getPHID())
- ->setItemType(NuanceGitHubEventItemType::ITEMTYPE)
->setItemKey($item_key)
->setItemContainerKey($container_key)
->setItemProperty('api.type', 'issue')
diff --git a/src/applications/nuance/cursor/NuanceGitHubRepositoryImportCursor.php b/src/applications/nuance/cursor/NuanceGitHubRepositoryImportCursor.php
--- a/src/applications/nuance/cursor/NuanceGitHubRepositoryImportCursor.php
+++ b/src/applications/nuance/cursor/NuanceGitHubRepositoryImportCursor.php
@@ -36,10 +36,9 @@
$container_key = "github.issue.{$issue_id}";
}
- return NuanceItem::initializeNewItem()
+ return NuanceItem::initializeNewItem(NuanceGitHubEventItemType::ITEMTYPE)
->setStatus(NuanceItem::STATUS_IMPORTING)
->setSourcePHID($source->getPHID())
- ->setItemType(NuanceGitHubEventItemType::ITEMTYPE)
->setItemKey($item_key)
->setItemContainerKey($container_key)
->setItemProperty('api.type', 'repository')
diff --git a/src/applications/nuance/item/NuanceFormItemType.php b/src/applications/nuance/item/NuanceFormItemType.php
new file mode 100644
--- /dev/null
+++ b/src/applications/nuance/item/NuanceFormItemType.php
@@ -0,0 +1,16 @@
+<?php
+
+final class NuanceFormItemType
+ extends NuanceItemType {
+
+ const ITEMTYPE = 'form.item';
+
+ public function getItemTypeDisplayName() {
+ return pht('Form');
+ }
+
+ public function getItemDisplayName(NuanceItem $item) {
+ return pht('Complaint');
+ }
+
+}
diff --git a/src/applications/nuance/phid/NuanceItemPHIDType.php b/src/applications/nuance/phid/NuanceItemPHIDType.php
--- a/src/applications/nuance/phid/NuanceItemPHIDType.php
+++ b/src/applications/nuance/phid/NuanceItemPHIDType.php
@@ -33,7 +33,7 @@
foreach ($handles as $phid => $handle) {
$item = $objects[$phid];
- $handle->setName($item->getItemDisplayName());
+ $handle->setName($item->getDisplayName());
$handle->setURI($item->getURI());
}
}
diff --git a/src/applications/nuance/source/NuancePhabricatorFormSourceDefinition.php b/src/applications/nuance/source/NuancePhabricatorFormSourceDefinition.php
--- a/src/applications/nuance/source/NuancePhabricatorFormSourceDefinition.php
+++ b/src/applications/nuance/source/NuancePhabricatorFormSourceDefinition.php
@@ -39,6 +39,8 @@
$content_source = PhabricatorContentSource::newFromRequest($request);
$item = $this->newItemFromProperties(
+ NuanceFormItemType::ITEMTYPE,
+ $viewer->getPHID(),
$properties,
$content_source);
@@ -79,7 +81,7 @@
NuanceItem $item,
PHUIPropertyListView $view) {
- $complaint = $item->getNuanceProperty('complaint');
+ $complaint = $item->getItemProperty('complaint');
$complaint = new PHUIRemarkupView($viewer, $complaint);
$view->addSectionHeader(
pht('Complaint'), 'fa-exclamation-circle');
diff --git a/src/applications/nuance/source/NuanceSourceDefinition.php b/src/applications/nuance/source/NuanceSourceDefinition.php
--- a/src/applications/nuance/source/NuanceSourceDefinition.php
+++ b/src/applications/nuance/source/NuanceSourceDefinition.php
@@ -149,6 +149,8 @@
}
protected function newItemFromProperties(
+ $item_type,
+ $author_phid,
array $properties,
PhabricatorContentSource $content_source) {
@@ -157,7 +159,7 @@
$actor = PhabricatorUser::getOmnipotentUser();
$source = $this->getSource();
- $item = NuanceItem::initializeNewItem();
+ $item = NuanceItem::initializeNewItem($item_type);
$xactions = array();
@@ -181,6 +183,7 @@
$editor = id(new NuanceItemEditor())
->setActor($actor)
+ ->setActingAsPHID($author_phid)
->setContentSource($content_source);
$editor->applyTransactions($item, $xactions);
diff --git a/src/applications/nuance/storage/NuanceItem.php b/src/applications/nuance/storage/NuanceItem.php
--- a/src/applications/nuance/storage/NuanceItem.php
+++ b/src/applications/nuance/storage/NuanceItem.php
@@ -26,8 +26,12 @@
private $source = self::ATTACHABLE;
private $implementation = self::ATTACHABLE;
- public static function initializeNewItem() {
+ public static function initializeNewItem($item_type) {
+
+ // TODO: Validate that the type is valid, and construct and attach it.
+
return id(new NuanceItem())
+ ->setItemType($item_type)
->setStatus(self::STATUS_OPEN);
}
@@ -42,7 +46,7 @@
'requestorPHID' => 'phid?',
'queuePHID' => 'phid?',
'itemType' => 'text64',
- 'itemKey' => 'text64',
+ 'itemKey' => 'text64?',
'itemContainerKey' => 'text64?',
'status' => 'text32',
'mailKey' => 'bytes20',
diff --git a/src/applications/nuance/xaction/NuanceItemPropertyTransaction.php b/src/applications/nuance/xaction/NuanceItemPropertyTransaction.php
--- a/src/applications/nuance/xaction/NuanceItemPropertyTransaction.php
+++ b/src/applications/nuance/xaction/NuanceItemPropertyTransaction.php
@@ -8,14 +8,14 @@
public function generateOldValue($object) {
$property_key = NuanceItemTransaction::PROPERTY_KEY;
$key = $this->getMetadataValue($property_key);
- return $object->getNuanceProperty($key);
+ return $object->getItemProperty($key);
}
public function applyInternalEffects($object, $value) {
$property_key = NuanceItemTransaction::PROPERTY_KEY;
$key = $this->getMetadataValue($property_key);
- $object->setNuanceProperty($key, $value);
+ $object->setItemProperty($key, $value);
}
public function getTitle() {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Oct 22, 8:55 PM (3 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6720783
Default Alt Text
D18007.id43310.diff (7 KB)
Attached To
Mode
D18007: Fix a handful of Nuance fatals
Attached
Detach File
Event Timeline
Log In to Comment