Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15345144
D19553.id46749.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D19553.id46749.diff
View Options
diff --git a/resources/sql/autopatches/20180730.phriction.01.spaces.sql b/resources/sql/autopatches/20180730.phriction.01.spaces.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20180730.phriction.01.spaces.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_phriction.phriction_document
+ ADD spacePHID VARBINARY(64) DEFAULT NULL;
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
@@ -11129,6 +11129,7 @@
'PhabricatorApplicationTransactionInterface',
'PhabricatorConduitResultInterface',
'PhabricatorPolicyCodexInterface',
+ 'PhabricatorSpacesInterface',
),
'PhrictionDocumentAuthorHeraldField' => 'PhrictionDocumentHeraldField',
'PhrictionDocumentContentHeraldField' => 'PhrictionDocumentHeraldField',
diff --git a/src/applications/phriction/controller/PhrictionEditController.php b/src/applications/phriction/controller/PhrictionEditController.php
--- a/src/applications/phriction/controller/PhrictionEditController.php
+++ b/src/applications/phriction/controller/PhrictionEditController.php
@@ -121,6 +121,8 @@
$v_projects = array_reverse($v_projects);
}
+ $v_space = $document->getSpacePHID();
+
if ($request->isFormPost()) {
$title = $request->getStr('title');
@@ -131,6 +133,7 @@
$v_edit = $request->getStr('editPolicy');
$v_cc = $request->getArr('cc');
$v_projects = $request->getArr('projects');
+ $v_space = $request->getStr('spacePHID');
$xactions = array();
$xactions[] = id(new PhrictionTransaction())
@@ -146,6 +149,9 @@
$xactions[] = id(new PhrictionTransaction())
->setTransactionType(PhabricatorTransactions::TYPE_EDIT_POLICY)
->setNewValue($v_edit);
+ $xactions[] = id(new PhrictionTransaction())
+ ->setTransactionType(PhabricatorTransactions::TYPE_SPACE)
+ ->setNewValue($v_space);
$xactions[] = id(new PhrictionTransaction())
->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS)
->setNewValue(array('=' => $v_cc));
@@ -192,6 +198,7 @@
$document->setViewPolicy($v_view);
$document->setEditPolicy($v_edit);
+ $document->setSpacePHID($v_space);
}
}
@@ -267,7 +274,9 @@
->setDatasource(new PhabricatorMetaMTAMailableDatasource()))
->appendChild(
id(new AphrontFormPolicyControl())
+ ->setViewer($viewer)
->setName('viewPolicy')
+ ->setSpacePHID($v_space)
->setPolicyObject($document)
->setCapability($view_capability)
->setPolicies($policies)
diff --git a/src/applications/phriction/query/PhrictionDocumentSearchEngine.php b/src/applications/phriction/query/PhrictionDocumentSearchEngine.php
--- a/src/applications/phriction/query/PhrictionDocumentSearchEngine.php
+++ b/src/applications/phriction/query/PhrictionDocumentSearchEngine.php
@@ -131,6 +131,7 @@
$item = id(new PHUIObjectItemView())
->setHeader($content->getTitle())
+ ->setObject($document)
->setHref($slug_uri)
->addByline($byline)
->addIcon('none', $updated);
diff --git a/src/applications/phriction/storage/PhrictionDocument.php b/src/applications/phriction/storage/PhrictionDocument.php
--- a/src/applications/phriction/storage/PhrictionDocument.php
+++ b/src/applications/phriction/storage/PhrictionDocument.php
@@ -12,7 +12,8 @@
PhabricatorProjectInterface,
PhabricatorApplicationTransactionInterface,
PhabricatorConduitResultInterface,
- PhabricatorPolicyCodexInterface {
+ PhabricatorPolicyCodexInterface,
+ PhabricatorSpacesInterface {
protected $slug;
protected $depth;
@@ -21,6 +22,7 @@
protected $mailKey;
protected $viewPolicy;
protected $editPolicy;
+ protected $spacePHID;
private $contentObject = self::ATTACHABLE;
private $ancestors = array();
@@ -81,12 +83,16 @@
}
if ($parent_doc) {
- $document->setViewPolicy($parent_doc->getViewPolicy());
- $document->setEditPolicy($parent_doc->getEditPolicy());
+ $document
+ ->setViewPolicy($parent_doc->getViewPolicy())
+ ->setEditPolicy($parent_doc->getEditPolicy())
+ ->setSpacePHID($parent_doc->getSpacePHID());
} else {
$default_view_policy = PhabricatorPolicies::getMostOpenPolicy();
- $document->setViewPolicy($default_view_policy);
- $document->setEditPolicy(PhabricatorPolicies::POLICY_USER);
+ $document
+ ->setViewPolicy($default_view_policy)
+ ->setEditPolicy(PhabricatorPolicies::POLICY_USER)
+ ->setSpacePHID($actor->getDefaultSpacePHID());
}
return $document;
@@ -202,6 +208,15 @@
}
+/* -( PhabricatorSpacesInterface )----------------------------------------- */
+
+
+ public function getSpacePHID() {
+ return $this->spacePHID;
+ }
+
+
+
/* -( PhabricatorSubscribableInterface )----------------------------------- */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 11, 8:49 AM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7514257
Default Alt Text
D19553.id46749.diff (4 KB)
Attached To
Mode
D19553: Add Spaces support to Phriction
Attached
Detach File
Event Timeline
Log In to Comment