Page MenuHomePhabricator

D12595.diff
No OneTemporary

D12595.diff

diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php b/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php
--- a/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php
+++ b/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php
@@ -40,6 +40,7 @@
$filter = 'event/create/';
$page_title = pht('Create Event');
$redirect = 'created';
+ $subscribers = array();
} else {
$event = id(new PhabricatorCalendarEventQuery())
->setViewer($user)
@@ -60,6 +61,9 @@
$filter = 'event/edit/'.$event->getID().'/';
$page_title = pht('Update Event');
$redirect = 'updated';
+
+ $subscribers = PhabricatorSubscribersQuery::loadSubscribersForPHID(
+ $event->getPHID());
}
$errors = array();
@@ -70,6 +74,7 @@
$start_value = $start_time->readValueFromRequest($request);
$end_value = $end_time->readValueFromRequest($request);
$description = $request->getStr('description');
+ $subscribers = $request->getArr('subscribers');
if ($start_time->getError()) {
$errors[] = pht('Invalid start time; reset to default.');
@@ -100,6 +105,11 @@
$xactions[] = id(new PhabricatorCalendarEventTransaction())
->setTransactionType(
+ PhabricatorTransactions::TYPE_SUBSCRIBERS)
+ ->setNewValue(array('=' => array_fuse($subscribers)));
+
+ $xactions[] = id(new PhabricatorCalendarEventTransaction())
+ ->setTransactionType(
PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION)
->setNewValue($description);
@@ -144,12 +154,21 @@
->setName('description')
->setValue($event->getDescription());
+ $subscribers = id(new AphrontFormTokenizerControl())
+ ->setLabel(pht('Subscribers'))
+ ->setName('subscribers')
+ ->setValue($subscribers)
+ ->setUser($user)
+ ->setDatasource(new PhabricatorMetaMTAMailableDatasource());
+
+
$form = id(new AphrontFormView())
->setUser($user)
->appendChild($name)
->appendChild($status_select)
->appendChild($start_time)
->appendChild($end_time)
+ ->appendControl($subscribers)
->appendChild($description);
$submit = id(new AphrontFormSubmitControl())
diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php b/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php
--- a/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php
+++ b/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php
@@ -69,7 +69,8 @@
$actions = id(new PhabricatorActionListView())
->setObjectURI($this->getApplicationURI('event/'.$id.'/'))
- ->setUser($viewer);
+ ->setUser($viewer)
+ ->setObject($event);
$can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer,
@@ -110,6 +111,8 @@
pht('Ends'),
phabricator_datetime($event->getDateTo(), $viewer));
+ $properties->invokeWillRenderEvent();
+
$properties->addSectionHeader(
pht('Description'),
PHUIPropertyListView::ICON_SUMMARY);
diff --git a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
--- a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
+++ b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
@@ -89,6 +89,7 @@
case PhabricatorTransactions::TYPE_VIEW_POLICY:
case PhabricatorTransactions::TYPE_EDIT_POLICY:
case PhabricatorTransactions::TYPE_EDGE:
+ case PhabricatorTransactions::TYPE_SUBSCRIBERS:
return;
}
@@ -108,6 +109,7 @@
case PhabricatorTransactions::TYPE_VIEW_POLICY:
case PhabricatorTransactions::TYPE_EDIT_POLICY:
case PhabricatorTransactions::TYPE_EDGE:
+ case PhabricatorTransactions::TYPE_SUBSCRIBERS:
return;
}
diff --git a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php
--- a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php
+++ b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php
@@ -171,7 +171,7 @@
$list = new PHUIObjectItemListView();
foreach ($events as $event) {
if ($event->getUserPHID() == $viewer->getPHID()) {
- $href = $this->getApplicationURI('/event/edit/'.$event->getID().'/');
+ $href = '/E'.$event->getID();
} else {
$from = $event->getDateFrom();
$month = phabricator_format_local_time($from, $viewer, 'm');
diff --git a/src/applications/calendar/storage/PhabricatorCalendarEvent.php b/src/applications/calendar/storage/PhabricatorCalendarEvent.php
--- a/src/applications/calendar/storage/PhabricatorCalendarEvent.php
+++ b/src/applications/calendar/storage/PhabricatorCalendarEvent.php
@@ -3,7 +3,8 @@
final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
implements PhabricatorPolicyInterface,
PhabricatorMarkupInterface,
- PhabricatorApplicationTransactionInterface {
+ PhabricatorApplicationTransactionInterface,
+ PhabricatorSubscribableInterface {
protected $name;
protected $userPHID;
@@ -30,6 +31,11 @@
self::STATUS_SPORADIC => 'sporadic',
);
+ public function setTextStatus($status) {
+ $statuses = array_flip(self::$statusTexts);
+ return $this->setStatus($statuses[$status]);
+ }
+
public function getTextStatus() {
return self::$statusTexts[$this->status];
}
@@ -82,9 +88,15 @@
}
}
- public function setTextStatus($status) {
- $statuses = array_flip(self::$statusTexts);
- return $this->setStatus($statuses[$status]);
+ public static function getNameForStatus($value) {
+ switch ($value) {
+ case self::STATUS_AWAY:
+ return pht('Away');
+ case self::STATUS_SPORADIC:
+ return pht('Sporadic');
+ default:
+ return pht('Unknown');
+ }
}
public function loadCurrentStatuses($user_phids) {
@@ -99,17 +111,6 @@
return mpull($statuses, null, 'getUserPHID');
}
- public static function getNameForStatus($value) {
- switch ($value) {
- case self::STATUS_AWAY:
- return pht('Away');
- case self::STATUS_SPORADIC:
- return pht('Sporadic');
- default:
- return pht('Unknown');
- }
- }
-
/**
* Validates data and throws exceptions for non-sensical status
* windows
@@ -219,4 +220,18 @@
return $timeline;
}
+/* -( PhabricatorSubscribableInterface )----------------------------------- */
+
+
+ public function isAutomaticallySubscribed($phid) {
+ return ($phid == $this->getUserPHID());
+ }
+
+ public function shouldShowSubscribersProperty() {
+ return true;
+ }
+
+ public function shouldAllowSubscription($phid) {
+ return true;
+ }
}

File Metadata

Mime Type
text/plain
Expires
Sat, Sep 21, 5:42 AM (22 h, 12 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6624946
Default Alt Text
D12595.diff (6 KB)

Event Timeline