Page MenuHomePhabricator

D12595.id30239.diff
No OneTemporary

D12595.id30239.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';
+ $cc_value = array();
} else {
$event = id(new PhabricatorCalendarEventQuery())
->setViewer($user)
@@ -60,6 +61,9 @@
$filter = 'event/edit/'.$event->getID().'/';
$page_title = pht('Update Event');
$redirect = 'updated';
+
+ $cc_value = 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');
+ $cc_value = $request->getArr('cc');
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($cc_value)));
+
+ $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('CC'))
+ ->setName('cc')
+ ->setValue($cc_value)
+ ->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;
+ }
}
diff --git a/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php b/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php
--- a/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php
+++ b/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php
@@ -27,6 +27,9 @@
public function getRequiredHandlePHIDs() {
$phids = parent::getRequiredHandlePHIDs();
+ $old = $this->getOldValue();
+ $new = $this->getNewValue();
+
switch ($this->getTransactionType()) {
case self::TYPE_NAME:
case self::TYPE_START_DATE:
@@ -228,8 +231,6 @@
$tags[] = self::MAILTAG_CONTENT;
break;
case self::TYPE_STATUS:
- $tags[] = self::MAILTAG_OTHER;
- break;
case self::TYPE_DESCRIPTION:
$tags[] = self::MAILTAG_CONTENT;
break;

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 11, 8:47 AM (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6764919
Default Alt Text
D12595.id30239.diff (7 KB)

Event Timeline