Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15332267
D20594.id49126.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D20594.id49126.diff
View Options
diff --git a/src/applications/transactions/storage/PhabricatorEditEngineConfigurationTransaction.php b/src/applications/transactions/storage/PhabricatorEditEngineConfigurationTransaction.php
--- a/src/applications/transactions/storage/PhabricatorEditEngineConfigurationTransaction.php
+++ b/src/applications/transactions/storage/PhabricatorEditEngineConfigurationTransaction.php
@@ -58,10 +58,23 @@
$this->renderHandleLink($author_phid));
case self::TYPE_DEFAULT:
$key = $this->getMetadataValue('field.key');
+
+ $object = $this->getObject();
+ $engine = $object->getEngine();
+ $fields = $engine->getFieldsForConfig($object);
+
+ $field = idx($fields, $key);
+ if (!$field) {
+ return pht(
+ '%s changed the default value for field "%s".',
+ $this->renderHandleLink($author_phid),
+ $key);
+ }
+
return pht(
'%s changed the default value for field "%s".',
$this->renderHandleLink($author_phid),
- $key);
+ $field->getLabel());
case self::TYPE_LOCKS:
return pht(
'%s changed locked and hidden fields.',
@@ -164,4 +177,49 @@
return $changes;
}
+ public function hasChangeDetails() {
+ switch ($this->getTransactionType()) {
+ case self::TYPE_DEFAULT:
+ return true;
+ }
+
+ return parent::hasChangeDetails();
+ }
+
+ public function renderChangeDetails(PhabricatorUser $viewer) {
+ switch ($this->getTransactionType()) {
+ case self::TYPE_DEFAULT:
+ $old_value = $this->getOldValue();
+ $new_value = $this->getNewValue();
+
+ $old_value = $this->renderDefaultValueAsFallbackText($old_value);
+ $new_value = $this->renderDefaultValueAsFallbackText($new_value);
+
+ return $this->renderTextCorpusChangeDetails(
+ $viewer,
+ $old_value,
+ $new_value);
+ }
+
+ return parent::renderChangeDetails($viewer);
+ }
+
+ private function renderDefaultValueAsFallbackText($default_value) {
+ // See T13319. When rendering an "alice changed the default value for
+ // field X." story on custom forms, we may fall back to a generic
+ // rendering. Try to present the value change in a comprehensible way
+ // even if it isn't especially human readable (for example, it may
+ // contain PHIDs or other internal identifiers).
+
+ if (is_scalar($default_value) || is_null($default_value)) {
+ return $default_value;
+ }
+
+ if (phutil_is_natural_list($default_value)) {
+ return id(new PhutilJSON())->encodeAsList($default_value);
+ }
+
+ return id(new PhutilJSON())->encodeAsObject($default_value);
+ }
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 8, 4:58 PM (5 d, 15 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7383362
Default Alt Text
D20594.id49126.diff (2 KB)
Attached To
Mode
D20594: Improve rendering of "default value changed" custom form transactions to at least have all the information
Attached
Detach File
Event Timeline
Log In to Comment