Page MenuHomePhabricator

D13235.diff
No OneTemporary

D13235.diff

diff --git a/resources/sql/autopatches/20150610.spaces.1.desc.sql b/resources/sql/autopatches/20150610.spaces.1.desc.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20150610.spaces.1.desc.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_spaces.spaces_namespace
+ ADD description LONGTEXT COLLATE {$COLLATE_TEXT} NOT NULL;
diff --git a/resources/sql/autopatches/20150610.spaces.2.edge.sql b/resources/sql/autopatches/20150610.spaces.2.edge.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20150610.spaces.2.edge.sql
@@ -0,0 +1,16 @@
+CREATE TABLE {$NAMESPACE}_spaces.edge (
+ src VARBINARY(64) NOT NULL,
+ type INT UNSIGNED NOT NULL,
+ dst VARBINARY(64) NOT NULL,
+ dateCreated INT UNSIGNED NOT NULL,
+ seq INT UNSIGNED NOT NULL,
+ dataID INT UNSIGNED,
+ PRIMARY KEY (src, type, dst),
+ KEY `src` (src, type, dateCreated, seq),
+ UNIQUE KEY `key_dst` (dst, type, src)
+) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
+
+CREATE TABLE {$NAMESPACE}_spaces.edgedata (
+ id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ data LONGTEXT NOT NULL COLLATE {$COLLATE_TEXT}
+) ENGINE=InnoDB, 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
@@ -2594,6 +2594,7 @@
'PhabricatorSpacesNamespaceTransaction' => 'applications/spaces/storage/PhabricatorSpacesNamespaceTransaction.php',
'PhabricatorSpacesNamespaceTransactionQuery' => 'applications/spaces/query/PhabricatorSpacesNamespaceTransactionQuery.php',
'PhabricatorSpacesRemarkupRule' => 'applications/spaces/remarkup/PhabricatorSpacesRemarkupRule.php',
+ 'PhabricatorSpacesSchemaSpec' => 'applications/spaces/storage/PhabricatorSpacesSchemaSpec.php',
'PhabricatorSpacesTestCase' => 'applications/spaces/__tests__/PhabricatorSpacesTestCase.php',
'PhabricatorSpacesViewController' => 'applications/spaces/controller/PhabricatorSpacesViewController.php',
'PhabricatorStandardCustomField' => 'infrastructure/customfield/standard/PhabricatorStandardCustomField.php',
@@ -6110,6 +6111,7 @@
'PhabricatorSpacesNamespaceTransaction' => 'PhabricatorApplicationTransaction',
'PhabricatorSpacesNamespaceTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'PhabricatorSpacesRemarkupRule' => 'PhabricatorObjectRemarkupRule',
+ 'PhabricatorSpacesSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorSpacesTestCase' => 'PhabricatorTestCase',
'PhabricatorSpacesViewController' => 'PhabricatorSpacesController',
'PhabricatorStandardCustomField' => 'PhabricatorCustomField',
diff --git a/src/applications/spaces/controller/PhabricatorSpacesEditController.php b/src/applications/spaces/controller/PhabricatorSpacesEditController.php
--- a/src/applications/spaces/controller/PhabricatorSpacesEditController.php
+++ b/src/applications/spaces/controller/PhabricatorSpacesEditController.php
@@ -54,6 +54,7 @@
$validation_exception = null;
$e_name = true;
$v_name = $space->getNamespaceName();
+ $v_desc = $space->getDescription();
$v_view = $space->getViewPolicy();
$v_edit = $space->getEditPolicy();
@@ -62,10 +63,12 @@
$e_name = null;
$v_name = $request->getStr('name');
+ $v_desc = $request->getStr('description');
$v_view = $request->getStr('viewPolicy');
$v_edit = $request->getStr('editPolicy');
$type_name = PhabricatorSpacesNamespaceTransaction::TYPE_NAME;
+ $type_desc = PhabricatorSpacesNamespaceTransaction::TYPE_DESCRIPTION;
$type_default = PhabricatorSpacesNamespaceTransaction::TYPE_DEFAULT;
$type_view = PhabricatorTransactions::TYPE_VIEW_POLICY;
$type_edit = PhabricatorTransactions::TYPE_EDIT_POLICY;
@@ -75,6 +78,10 @@
->setNewValue($v_name);
$xactions[] = id(new PhabricatorSpacesNamespaceTransaction())
+ ->setTransactionType($type_desc)
+ ->setNewValue($v_desc);
+
+ $xactions[] = id(new PhabricatorSpacesNamespaceTransaction())
->setTransactionType($type_view)
->setNewValue($v_view);
@@ -128,6 +135,11 @@
->setName('name')
->setValue($v_name)
->setError($e_name))
+ ->appendControl(
+ id(new PhabricatorRemarkupControl())
+ ->setLabel(pht('Description'))
+ ->setName('description')
+ ->setValue($v_desc))
->appendChild(
id(new AphrontFormPolicyControl())
->setUser($viewer)
diff --git a/src/applications/spaces/controller/PhabricatorSpacesViewController.php b/src/applications/spaces/controller/PhabricatorSpacesViewController.php
--- a/src/applications/spaces/controller/PhabricatorSpacesViewController.php
+++ b/src/applications/spaces/controller/PhabricatorSpacesViewController.php
@@ -75,6 +75,20 @@
pht('Editable By'),
$descriptions[PhabricatorPolicyCapability::CAN_EDIT]);
+ $description = $space->getDescription();
+ if (strlen($description)) {
+ $description = PhabricatorMarkupEngine::renderOneObject(
+ id(new PhabricatorMarkupOneOff())->setContent($description),
+ 'default',
+ $viewer);
+
+ $list->addSectionHeader(
+ pht('Description'),
+ PHUIPropertyListView::ICON_SUMMARY);
+
+ $list->addTextContent($description);
+ }
+
return $list;
}
diff --git a/src/applications/spaces/editor/PhabricatorSpacesNamespaceEditor.php b/src/applications/spaces/editor/PhabricatorSpacesNamespaceEditor.php
--- a/src/applications/spaces/editor/PhabricatorSpacesNamespaceEditor.php
+++ b/src/applications/spaces/editor/PhabricatorSpacesNamespaceEditor.php
@@ -15,6 +15,7 @@
$types = parent::getTransactionTypes();
$types[] = PhabricatorSpacesNamespaceTransaction::TYPE_NAME;
+ $types[] = PhabricatorSpacesNamespaceTransaction::TYPE_DESCRIPTION;
$types[] = PhabricatorSpacesNamespaceTransaction::TYPE_DEFAULT;
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
@@ -34,6 +35,11 @@
return null;
}
return $name;
+ case PhabricatorSpacesNamespaceTransaction::TYPE_DESCRIPTION:
+ if ($this->getIsNewObject()) {
+ return null;
+ }
+ return $object->getDescription();
case PhabricatorSpacesNamespaceTransaction::TYPE_DEFAULT:
return $object->getIsDefaultNamespace() ? 1 : null;
case PhabricatorTransactions::TYPE_VIEW_POLICY:
@@ -51,6 +57,7 @@
switch ($xaction->getTransactionType()) {
case PhabricatorSpacesNamespaceTransaction::TYPE_NAME:
+ case PhabricatorSpacesNamespaceTransaction::TYPE_DESCRIPTION:
case PhabricatorTransactions::TYPE_VIEW_POLICY:
case PhabricatorTransactions::TYPE_EDIT_POLICY:
return $xaction->getNewValue();
@@ -71,6 +78,9 @@
case PhabricatorSpacesNamespaceTransaction::TYPE_NAME:
$object->setNamespaceName($new);
return;
+ case PhabricatorSpacesNamespaceTransaction::TYPE_DESCRIPTION:
+ $object->setDescription($new);
+ return;
case PhabricatorSpacesNamespaceTransaction::TYPE_DEFAULT:
$object->setIsDefaultNamespace($new ? 1 : null);
return;
@@ -91,6 +101,7 @@
switch ($xaction->getTransactionType()) {
case PhabricatorSpacesNamespaceTransaction::TYPE_NAME:
+ case PhabricatorSpacesNamespaceTransaction::TYPE_DESCRIPTION:
case PhabricatorSpacesNamespaceTransaction::TYPE_DEFAULT:
case PhabricatorTransactions::TYPE_VIEW_POLICY:
case PhabricatorTransactions::TYPE_EDIT_POLICY:
diff --git a/src/applications/spaces/phid/PhabricatorSpacesNamespacePHIDType.php b/src/applications/spaces/phid/PhabricatorSpacesNamespacePHIDType.php
--- a/src/applications/spaces/phid/PhabricatorSpacesNamespacePHIDType.php
+++ b/src/applications/spaces/phid/PhabricatorSpacesNamespacePHIDType.php
@@ -32,9 +32,12 @@
foreach ($handles as $phid => $handle) {
$namespace = $objects[$phid];
+
$monogram = $namespace->getMonogram();
+ $name = $namespace->getNamespaceName();
- $handle->setName($namespace->getNamespaceName());
+ $handle->setName($name);
+ $handle->setFullName(pht('%s %s', $monogram, $name));
$handle->setURI('/'.$monogram);
}
}
diff --git a/src/applications/spaces/storage/PhabricatorSpacesNamespace.php b/src/applications/spaces/storage/PhabricatorSpacesNamespace.php
--- a/src/applications/spaces/storage/PhabricatorSpacesNamespace.php
+++ b/src/applications/spaces/storage/PhabricatorSpacesNamespace.php
@@ -11,6 +11,7 @@
protected $viewPolicy;
protected $editPolicy;
protected $isDefaultNamespace;
+ protected $description;
public static function initializeNewNamespace(PhabricatorUser $actor) {
$app = id(new PhabricatorApplicationQuery())
@@ -26,7 +27,8 @@
return id(new PhabricatorSpacesNamespace())
->setIsDefaultNamespace(null)
->setViewPolicy($view_policy)
- ->setEditPolicy($edit_policy);
+ ->setEditPolicy($edit_policy)
+ ->setDescription('');
}
protected function getConfiguration() {
@@ -35,6 +37,7 @@
self::CONFIG_COLUMN_SCHEMA => array(
'namespaceName' => 'text255',
'isDefaultNamespace' => 'bool?',
+ 'description' => 'text',
),
self::CONFIG_KEY_SCHEMA => array(
'key_default' => array(
diff --git a/src/applications/spaces/storage/PhabricatorSpacesNamespaceTransaction.php b/src/applications/spaces/storage/PhabricatorSpacesNamespaceTransaction.php
--- a/src/applications/spaces/storage/PhabricatorSpacesNamespaceTransaction.php
+++ b/src/applications/spaces/storage/PhabricatorSpacesNamespaceTransaction.php
@@ -5,6 +5,7 @@
const TYPE_NAME = 'spaces:name';
const TYPE_DEFAULT = 'spaces:default';
+ const TYPE_DESCRIPTION = 'spaces:description';
public function getApplicationName() {
return 'spaces';
@@ -18,6 +19,38 @@
return null;
}
+ public function shouldHide() {
+ $old = $this->getOldValue();
+
+ switch ($this->getTransactionType()) {
+ case self::TYPE_DESCRIPTION:
+ return ($old === null);
+ }
+
+ return parent::shouldHide();
+ }
+
+ public function hasChangeDetails() {
+ switch ($this->getTransactionType()) {
+ case self::TYPE_DESCRIPTION:
+ return true;
+ }
+
+ return parent::hasChangeDetails();
+ }
+
+ public function getRemarkupBlocks() {
+ $blocks = parent::getRemarkupBlocks();
+
+ switch ($this->getTransactionType()) {
+ case self::TYPE_DESCRIPTION:
+ $blocks[] = $this->getNewValue();
+ break;
+ }
+
+ return $blocks;
+ }
+
public function getTitle() {
$old = $this->getOldValue();
$new = $this->getNewValue();
@@ -37,6 +70,10 @@
$old,
$new);
}
+ case self::TYPE_DESCRIPTION:
+ return pht(
+ '%s updated the description for this space.',
+ $this->renderHandleLink($author_phid));
case self::TYPE_DEFAULT:
return pht(
'%s made this the default space.',
diff --git a/src/applications/spaces/storage/PhabricatorSpacesSchemaSpec.php b/src/applications/spaces/storage/PhabricatorSpacesSchemaSpec.php
new file mode 100644
--- /dev/null
+++ b/src/applications/spaces/storage/PhabricatorSpacesSchemaSpec.php
@@ -0,0 +1,10 @@
+<?php
+
+final class PhabricatorSpacesSchemaSpec
+ extends PhabricatorConfigSchemaSpec {
+
+ public function buildSchemata() {
+ $this->buildEdgeSchemata(new PhabricatorSpacesNamespace());
+ }
+
+}

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 19, 4:35 AM (8 h, 19 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6728656
Default Alt Text
D13235.diff (11 KB)

Event Timeline