Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15571400
D8182.id18510.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
12 KB
Referenced Files
None
Subscribers
None
D8182.id18510.diff
View Options
diff --git a/resources/sql/autopatches/20140210.projcfield.1.blurb.php b/resources/sql/autopatches/20140210.projcfield.1.blurb.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20140210.projcfield.1.blurb.php
@@ -0,0 +1,26 @@
+<?php
+
+$conn_w = id(new PhabricatorProject())->establishConnection('w');
+$table_name = id(new PhabricatorProjectCustomFieldStorage())->getTableName();
+
+$rows = new LiskRawMigrationIterator($conn_w, 'project_profile');
+
+echo "Migrating project descriptions to custom storage...\n";
+foreach ($rows as $row) {
+ $phid = $row['projectPHID'];
+ echo "Migrating {$phid}...\n";
+
+ $desc = $row['blurb'];
+ if (strlen($desc)) {
+ queryfx(
+ $conn_w,
+ 'INSERT IGNORE INTO %T (objectPHID, fieldIndex, fieldValue)
+ VALUES (%s, %s, %s)',
+ $table_name,
+ $phid,
+ PhabricatorHash::digestForIndex('std:project:internal:description'),
+ $desc);
+ }
+}
+
+echo "Done.\n";
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
@@ -1837,6 +1837,7 @@
'PhabricatorProjectCustomFieldStorage' => 'applications/project/storage/PhabricatorProjectCustomFieldStorage.php',
'PhabricatorProjectCustomFieldStringIndex' => 'applications/project/storage/PhabricatorProjectCustomFieldStringIndex.php',
'PhabricatorProjectDAO' => 'applications/project/storage/PhabricatorProjectDAO.php',
+ 'PhabricatorProjectDescriptionField' => 'applications/project/customfield/PhabricatorProjectDescriptionField.php',
'PhabricatorProjectEditorTestCase' => 'applications/project/editor/__tests__/PhabricatorProjectEditorTestCase.php',
'PhabricatorProjectHistoryController' => 'applications/project/controller/PhabricatorProjectHistoryController.php',
'PhabricatorProjectListController' => 'applications/project/controller/PhabricatorProjectListController.php',
@@ -1852,6 +1853,7 @@
'PhabricatorProjectQuery' => 'applications/project/query/PhabricatorProjectQuery.php',
'PhabricatorProjectSearchEngine' => 'applications/project/query/PhabricatorProjectSearchEngine.php',
'PhabricatorProjectSearchIndexer' => 'applications/project/search/PhabricatorProjectSearchIndexer.php',
+ 'PhabricatorProjectStandardCustomField' => 'applications/project/customfield/PhabricatorProjectStandardCustomField.php',
'PhabricatorProjectStatus' => 'applications/project/constants/PhabricatorProjectStatus.php',
'PhabricatorProjectTestDataGenerator' => 'applications/project/lipsum/PhabricatorProjectTestDataGenerator.php',
'PhabricatorProjectTransaction' => 'applications/project/storage/PhabricatorProjectTransaction.php',
@@ -4568,7 +4570,7 @@
'PhabricatorProjectConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorProjectConfiguredCustomField' =>
array(
- 0 => 'PhabricatorProjectCustomField',
+ 0 => 'PhabricatorProjectStandardCustomField',
1 => 'PhabricatorStandardCustomFieldInterface',
),
'PhabricatorProjectController' => 'PhabricatorController',
@@ -4578,6 +4580,7 @@
'PhabricatorProjectCustomFieldStorage' => 'PhabricatorCustomFieldStorage',
'PhabricatorProjectCustomFieldStringIndex' => 'PhabricatorCustomFieldStringIndexStorage',
'PhabricatorProjectDAO' => 'PhabricatorLiskDAO',
+ 'PhabricatorProjectDescriptionField' => 'PhabricatorProjectStandardCustomField',
'PhabricatorProjectEditorTestCase' => 'PhabricatorTestCase',
'PhabricatorProjectHistoryController' => 'PhabricatorProjectController',
'PhabricatorProjectListController' =>
@@ -4597,6 +4600,11 @@
'PhabricatorProjectQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorProjectSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhabricatorProjectSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
+ 'PhabricatorProjectStandardCustomField' =>
+ array(
+ 0 => 'PhabricatorProjectCustomField',
+ 1 => 'PhabricatorStandardCustomFieldInterface',
+ ),
'PhabricatorProjectTestDataGenerator' => 'PhabricatorTestDataGenerator',
'PhabricatorProjectTransaction' => 'PhabricatorApplicationTransaction',
'PhabricatorProjectTransactionEditor' => 'PhabricatorApplicationTransactionEditor',
diff --git a/src/applications/project/config/PhabricatorProjectConfigOptions.php b/src/applications/project/config/PhabricatorProjectConfigOptions.php
--- a/src/applications/project/config/PhabricatorProjectConfigOptions.php
+++ b/src/applications/project/config/PhabricatorProjectConfigOptions.php
@@ -14,7 +14,9 @@
public function getOptions() {
// This is intentionally blank for now, until we can move more Project
// logic to custom fields.
- $default_fields = array();
+ $default_fields = array(
+ 'std:project:internal:description' => true,
+ );
foreach ($default_fields as $key => $enabled) {
$default_fields[$key] = array(
diff --git a/src/applications/project/controller/PhabricatorProjectCreateController.php b/src/applications/project/controller/PhabricatorProjectCreateController.php
--- a/src/applications/project/controller/PhabricatorProjectCreateController.php
+++ b/src/applications/project/controller/PhabricatorProjectCreateController.php
@@ -40,11 +40,10 @@
// TODO: Deal with name collision exceptions more gracefully.
- $profile->setBlurb($request->getStr('blurb'));
-
if (!$errors) {
$project->save();
$profile->setProjectPHID($project->getPHID());
+ $profile->setBlurb('');
$profile->save();
if ($request->isAjax()) {
@@ -79,13 +78,7 @@
->setLabel(pht('Name'))
->setName('name')
->setValue($project->getName())
- ->setError($e_name))
- ->appendChild(
- id(new AphrontFormTextAreaControl())
- ->setLabel(pht('Blurb'))
- ->setName('blurb')
- ->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_SHORT)
- ->setValue($profile->getBlurb()));
+ ->setError($e_name));
if ($request->isAjax()) {
$dialog = id(new AphrontDialogView())
diff --git a/src/applications/project/controller/PhabricatorProjectProfileController.php b/src/applications/project/controller/PhabricatorProjectProfileController.php
--- a/src/applications/project/controller/PhabricatorProjectProfileController.php
+++ b/src/applications/project/controller/PhabricatorProjectProfileController.php
@@ -271,13 +271,6 @@
PhabricatorCustomField::ROLE_VIEW);
$field_list->appendFieldsToPropertyList($project, $viewer, $view);
- $view->addSectionHeader(pht('Description'));
- $view->addTextContent(
- PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent($profile->getBlurb()),
- 'default',
- $viewer));
-
return $view;
}
diff --git a/src/applications/project/controller/PhabricatorProjectProfileEditController.php b/src/applications/project/controller/PhabricatorProjectProfileEditController.php
--- a/src/applications/project/controller/PhabricatorProjectProfileEditController.php
+++ b/src/applications/project/controller/PhabricatorProjectProfileEditController.php
@@ -21,14 +21,11 @@
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
- ->needProfiles(true)
->executeOne();
if (!$project) {
return new Aphront404Response();
}
- $profile = $project->getProfile();
-
$field_list = PhabricatorCustomField::getObjectFields(
$project,
PhabricatorCustomField::ROLE_EDIT);
@@ -42,7 +39,6 @@
$e_edit = null;
$v_name = $project->getName();
- $v_desc = $profile->getBlurb();
$validation_exception = null;
@@ -50,7 +46,6 @@
$e_name = null;
$v_name = $request->getStr('name');
- $v_desc = $request->getStr('blurb');
$v_view = $request->getStr('can_view');
$v_edit = $request->getStr('can_edit');
$v_join = $request->getStr('can_join');
@@ -86,13 +81,6 @@
try {
$editor->applyTransactions($project, $xactions);
- // TODO: Move this into a custom field.
- $profile->setBlurb($request->getStr('blurb'));
- if (!$profile->getProjectPHID()) {
- $profile->setProjectPHID($project->getPHID());
- }
- $profile->save();
-
return id(new AphrontRedirectResponse())->setURI($view_uri);
} catch (PhabricatorApplicationTransactionValidationException $ex) {
$validation_exception = $ex;
@@ -108,7 +96,6 @@
$header_name = pht('Edit Project');
$title = pht('Edit Project');
- $action = '/project/edit/'.$project->getID().'/';
$policies = id(new PhabricatorPolicyQuery())
->setViewer($viewer)
@@ -117,20 +104,13 @@
$form = new AphrontFormView();
$form
- ->setID('project-edit-form')
->setUser($viewer)
- ->setAction($action)
->appendChild(
id(new AphrontFormTextControl())
->setLabel(pht('Name'))
->setName('name')
->setValue($v_name)
- ->setError($e_name))
- ->appendChild(
- id(new PhabricatorRemarkupControl())
- ->setLabel(pht('Description'))
- ->setName('blurb')
- ->setValue($v_desc));
+ ->setError($e_name));
$field_list->appendFieldsToForm($form);
diff --git a/src/applications/project/customfield/PhabricatorProjectConfiguredCustomField.php b/src/applications/project/customfield/PhabricatorProjectConfiguredCustomField.php
--- a/src/applications/project/customfield/PhabricatorProjectConfiguredCustomField.php
+++ b/src/applications/project/customfield/PhabricatorProjectConfiguredCustomField.php
@@ -1,7 +1,7 @@
<?php
final class PhabricatorProjectConfiguredCustomField
- extends PhabricatorProjectCustomField
+ extends PhabricatorProjectStandardCustomField
implements PhabricatorStandardCustomFieldInterface {
public function getStandardCustomFieldNamespace() {
@@ -16,16 +16,4 @@
array()));
}
- public function newStorageObject() {
- return new PhabricatorProjectCustomFieldStorage();
- }
-
- protected function newStringIndexStorage() {
- return new PhabricatorProjectCustomFieldStringIndex();
- }
-
- protected function newNumericIndexStorage() {
- return new PhabricatorProjectCustomFieldNumericIndex();
- }
-
}
diff --git a/src/applications/project/customfield/PhabricatorProjectDescriptionField.php b/src/applications/project/customfield/PhabricatorProjectDescriptionField.php
new file mode 100644
--- /dev/null
+++ b/src/applications/project/customfield/PhabricatorProjectDescriptionField.php
@@ -0,0 +1,18 @@
+<?php
+
+final class PhabricatorProjectDescriptionField
+ extends PhabricatorProjectStandardCustomField {
+
+ public function createFields() {
+ return PhabricatorStandardCustomField::buildStandardFields(
+ $this,
+ array(
+ 'description' => array(
+ 'name' => pht('Description'),
+ 'type' => 'remarkup',
+ 'description' => pht('Short project description.'),
+ ),
+ ));
+ }
+
+}
diff --git a/src/applications/project/customfield/PhabricatorProjectConfiguredCustomField.php b/src/applications/project/customfield/PhabricatorProjectStandardCustomField.php
copy from src/applications/project/customfield/PhabricatorProjectConfiguredCustomField.php
copy to src/applications/project/customfield/PhabricatorProjectStandardCustomField.php
--- a/src/applications/project/customfield/PhabricatorProjectConfiguredCustomField.php
+++ b/src/applications/project/customfield/PhabricatorProjectStandardCustomField.php
@@ -1,19 +1,11 @@
<?php
-final class PhabricatorProjectConfiguredCustomField
+abstract class PhabricatorProjectStandardCustomField
extends PhabricatorProjectCustomField
implements PhabricatorStandardCustomFieldInterface {
public function getStandardCustomFieldNamespace() {
- return 'project';
- }
-
- public function createFields() {
- return PhabricatorStandardCustomField::buildStandardFields(
- $this,
- PhabricatorEnv::getEnvConfig(
- 'projects.custom-field-definitions',
- array()));
+ return 'project:internal';
}
public function newStorageObject() {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, May 6, 6:04 AM (1 d, 21 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7687498
Default Alt Text
D8182.id18510.diff (12 KB)
Attached To
Mode
D8182: Migrate project blurb/description to standard custom field storage
Attached
Detach File
Event Timeline
Log In to Comment