Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13955123
D13634.id32956.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D13634.id32956.diff
View Options
diff --git a/resources/sql/autopatches/20150714.spaces.countdown.1.sql b/resources/sql/autopatches/20150714.spaces.countdown.1.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20150714.spaces.countdown.1.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_countdown.countdown
+ADD spacePHID VARBINARY(64);
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
@@ -5496,6 +5496,7 @@
'PhabricatorCountdown' => array(
'PhabricatorCountdownDAO',
'PhabricatorPolicyInterface',
+ 'PhabricatorSpacesInterface',
),
'PhabricatorCountdownApplication' => 'PhabricatorApplication',
'PhabricatorCountdownController' => 'PhabricatorController',
diff --git a/src/applications/countdown/controller/PhabricatorCountdownEditController.php b/src/applications/countdown/controller/PhabricatorCountdownEditController.php
--- a/src/applications/countdown/controller/PhabricatorCountdownEditController.php
+++ b/src/applications/countdown/controller/PhabricatorCountdownEditController.php
@@ -41,9 +41,11 @@
$e_epoch = null;
$v_text = $countdown->getTitle();
+ $v_space = $countdown->getSpacePHID();
if ($request->isFormPost()) {
$v_text = $request->getStr('title');
+ $v_space = $request->getStr('spacePHID');
$date_value = AphrontFormDateControlValue::newFromRequest(
$request,
'epoch');
@@ -63,6 +65,7 @@
$countdown->setTitle($v_text);
$countdown->setEpoch($date_value->getEpoch());
$countdown->setViewPolicy($view_policy);
+ $countdown->setSpacePHID($v_space);
$countdown->save();
return id(new AphrontRedirectResponse())
->setURI('/countdown/'.$countdown->getID().'/');
@@ -109,6 +112,7 @@
->setName('viewPolicy')
->setPolicyObject($countdown)
->setPolicies($policies)
+ ->setSpacePHID($v_space)
->setCapability(PhabricatorPolicyCapability::CAN_VIEW))
->appendChild(
id(new AphrontFormSubmitControl())
diff --git a/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php b/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php
--- a/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php
+++ b/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php
@@ -117,6 +117,8 @@
$id = $countdown->getID();
$item = id(new PHUIObjectItemView())
+ ->setUser($viewer)
+ ->setObject($countdown)
->setObjectName("C{$id}")
->setHeader($countdown->getTitle())
->setHref($this->getApplicationURI("{$id}/"))
diff --git a/src/applications/countdown/storage/PhabricatorCountdown.php b/src/applications/countdown/storage/PhabricatorCountdown.php
--- a/src/applications/countdown/storage/PhabricatorCountdown.php
+++ b/src/applications/countdown/storage/PhabricatorCountdown.php
@@ -2,13 +2,16 @@
final class PhabricatorCountdown
extends PhabricatorCountdownDAO
- implements PhabricatorPolicyInterface {
+ implements PhabricatorPolicyInterface,
+ PhabricatorSpacesInterface {
protected $title;
protected $authorPHID;
protected $epoch;
protected $viewPolicy;
+ protected $spacePHID;
+
public static function initializeNewCountdown(PhabricatorUser $actor) {
$app = id(new PhabricatorApplicationQuery())
->setViewer($actor)
@@ -21,7 +24,8 @@
return id(new PhabricatorCountdown())
->setAuthorPHID($actor->getPHID())
->setViewPolicy($view_policy)
- ->setEpoch(PhabricatorTime::getNow());
+ ->setEpoch(PhabricatorTime::getNow())
+ ->setSpacePHID($actor->getDefaultSpacePHID());
}
protected function getConfiguration() {
@@ -66,4 +70,10 @@
return pht('The author of a countdown can always view and edit it.');
}
+/* -( PhabricatorSpacesInterface )------------------------------------------- */
+
+ public function getSpacePHID() {
+ return $this->spacePHID;
+ }
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Oct 15 2024, 12:17 AM (5 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6710552
Default Alt Text
D13634.id32956.diff (3 KB)
Attached To
Mode
D13634: Implementing Spaces in Countdown
Attached
Detach File
Event Timeline
Log In to Comment