Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14837503
D17083.id.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
D17083.id.diff
View Options
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
@@ -572,7 +572,6 @@
'DifferentialTestPlanCommitMessageField' => 'applications/differential/field/DifferentialTestPlanCommitMessageField.php',
'DifferentialTestPlanField' => 'applications/differential/customfield/DifferentialTestPlanField.php',
'DifferentialTitleCommitMessageField' => 'applications/differential/field/DifferentialTitleCommitMessageField.php',
- 'DifferentialTitleField' => 'applications/differential/customfield/DifferentialTitleField.php',
'DifferentialTransaction' => 'applications/differential/storage/DifferentialTransaction.php',
'DifferentialTransactionComment' => 'applications/differential/storage/DifferentialTransactionComment.php',
'DifferentialTransactionEditor' => 'applications/differential/editor/DifferentialTransactionEditor.php',
@@ -5236,7 +5235,6 @@
'DifferentialTestPlanCommitMessageField' => 'DifferentialCommitMessageField',
'DifferentialTestPlanField' => 'DifferentialCoreCustomField',
'DifferentialTitleCommitMessageField' => 'DifferentialCommitMessageField',
- 'DifferentialTitleField' => 'DifferentialCoreCustomField',
'DifferentialTransaction' => 'PhabricatorModularTransaction',
'DifferentialTransactionComment' => 'PhabricatorApplicationTransactionComment',
'DifferentialTransactionEditor' => 'PhabricatorApplicationTransactionEditor',
diff --git a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php
--- a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php
+++ b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php
@@ -25,7 +25,6 @@
$custom_field_type = 'custom:PhabricatorCustomFieldConfigOptionType';
$fields = array(
- new DifferentialTitleField(),
new DifferentialSummaryField(),
new DifferentialTestPlanField(),
new DifferentialReviewersField(),
diff --git a/src/applications/differential/customfield/DifferentialTitleField.php b/src/applications/differential/customfield/DifferentialTitleField.php
deleted file mode 100644
--- a/src/applications/differential/customfield/DifferentialTitleField.php
+++ /dev/null
@@ -1,125 +0,0 @@
-<?php
-
-final class DifferentialTitleField
- extends DifferentialCoreCustomField {
-
- public function getFieldKey() {
- return 'differential:title';
- }
-
- public function getFieldKeyForConduit() {
- return 'title';
- }
-
- public function getFieldName() {
- return pht('Title');
- }
-
- public function getFieldDescription() {
- return pht('Stores the revision title.');
- }
-
- public static function getDefaultTitle() {
- return pht('<<Replace this line with your Revision Title>>');
- }
-
- protected function readValueFromRevision(
- DifferentialRevision $revision) {
- return $revision->getTitle();
- }
-
- protected function writeValueToRevision(
- DifferentialRevision $revision,
- $value) {
- $revision->setTitle($value);
- }
-
- protected function getCoreFieldRequiredErrorString() {
- return pht('You must choose a title for this revision.');
- }
-
- public function readValueFromRequest(AphrontRequest $request) {
- $this->setValue($request->getStr($this->getFieldKey()));
- }
-
- protected function isCoreFieldRequired() {
- return true;
- }
-
- public function renderEditControl(array $handles) {
- return id(new AphrontFormTextAreaControl())
- ->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_SHORT)
- ->setName($this->getFieldKey())
- ->setValue($this->getValue())
- ->setError($this->getFieldError())
- ->setLabel($this->getFieldName());
- }
-
- public function getApplicationTransactionTitle(
- PhabricatorApplicationTransaction $xaction) {
- $author_phid = $xaction->getAuthorPHID();
- $old = $xaction->getOldValue();
- $new = $xaction->getNewValue();
-
- if (strlen($old)) {
- return pht(
- '%s retitled this revision from "%s" to "%s".',
- $xaction->renderHandleLink($author_phid),
- $old,
- $new);
- } else {
- return pht(
- '%s created this revision.',
- $xaction->renderHandleLink($author_phid));
- }
- }
-
- public function getApplicationTransactionTitleForFeed(
- PhabricatorApplicationTransaction $xaction) {
-
- $object_phid = $xaction->getObjectPHID();
- $author_phid = $xaction->getAuthorPHID();
- $old = $xaction->getOldValue();
- $new = $xaction->getNewValue();
-
- if (strlen($old)) {
- return pht(
- '%s retitled %s, from "%s" to "%s".',
- $xaction->renderHandleLink($author_phid),
- $xaction->renderHandleLink($object_phid),
- $old,
- $new);
- } else {
- return pht(
- '%s created %s.',
- $xaction->renderHandleLink($author_phid),
- $xaction->renderHandleLink($object_phid));
- }
- }
-
- public function shouldAppearInCommitMessage() {
- return true;
- }
-
- public function shouldOverwriteWhenCommitMessageIsEdited() {
- return true;
- }
-
- public function validateCommitMessageValue($value) {
- if (!strlen($value)) {
- throw new DifferentialFieldValidationException(
- pht(
- 'You must provide a revision title in the first line '.
- 'of your commit message.'));
- }
-
- if (preg_match('/^<<.*>>$/', $value)) {
- throw new DifferentialFieldValidationException(
- pht(
- 'Replace the line "%s" with a human-readable revision title which '.
- 'describes the changes you are making.',
- self::getDefaultTitle()));
- }
- }
-
-}
diff --git a/src/applications/differential/storage/DifferentialTransaction.php b/src/applications/differential/storage/DifferentialTransaction.php
--- a/src/applications/differential/storage/DifferentialTransaction.php
+++ b/src/applications/differential/storage/DifferentialTransaction.php
@@ -22,6 +22,23 @@
return 'DifferentialRevisionTransactionType';
}
+ protected function newFallbackModularTransactionType() {
+ // TODO: This allows us to render modern strings for older transactions
+ // without doing a migration. At some point, we should do a migration and
+ // throw this away.
+
+ $xaction_type = $this->getTransactionType();
+ if ($xaction_type == PhabricatorTransactions::TYPE_CUSTOMFIELD) {
+ switch ($this->getMetadataValue('customfield:key')) {
+ case 'differential:title':
+ return new DifferentialRevisionTitleTransaction();
+ }
+ }
+
+ return parent::newFallbackModularTransactionType();
+ }
+
+
public function setIsCommandeerSideEffect($is_side_effect) {
$this->isCommandeerSideEffect = $is_side_effect;
return $this;
diff --git a/src/applications/transactions/storage/PhabricatorModularTransaction.php b/src/applications/transactions/storage/PhabricatorModularTransaction.php
--- a/src/applications/transactions/storage/PhabricatorModularTransaction.php
+++ b/src/applications/transactions/storage/PhabricatorModularTransaction.php
@@ -46,7 +46,7 @@
$key = $this->getTransactionType();
if (empty($types[$key])) {
- $type = new PhabricatorCoreVoidTransaction();
+ $type = $this->newFallbackModularTransactionType();
} else {
$type = clone $types[$key];
}
@@ -56,6 +56,10 @@
return $type;
}
+ protected function newFallbackModularTransactionType() {
+ return new PhabricatorCoreVoidTransaction();
+ }
+
final public function generateOldValue($object) {
return $this->getTransactionImplementation()->generateOldValue($object);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Feb 1, 9:37 AM (18 h, 36 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7081417
Default Alt Text
D17083.id.diff (7 KB)
Attached To
Mode
D17083: Remove Differential "Title" custom field
Attached
Detach File
Event Timeline
Log In to Comment