1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 16:52:41 +01:00

Calendar events should now surface to Feed.

Summary: Closes T7955, Calendar events should now surface to Feed.

Test Plan: Create and/or edit an calendar event, open Feed, inspect the Feed stories for the event.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7955

Differential Revision: https://secure.phabricator.com/D12597
This commit is contained in:
lkassianik 2015-04-28 12:01:59 -07:00
parent cd7fec1729
commit b1081a1553
3 changed files with 37 additions and 10 deletions

View file

@ -144,4 +144,14 @@ final class PhabricatorCalendarEventEditor
return $errors; return $errors;
} }
protected function getMailTo(PhabricatorLiskDAO $object) {
return array($object->getUserPHID());
}
protected function shouldPublishFeedStory(
PhabricatorLiskDAO $object,
array $xactions) {
return true;
}
} }

View file

@ -29,10 +29,10 @@ final class PhabricatorCalendarEventPHIDType extends PhabricatorPHIDType {
$event = $objects[$phid]; $event = $objects[$phid];
$id = $event->getID(); $id = $event->getID();
$name = pht('Event %d', $id); $name = $event->getName();
$handle $handle
->setName(pht('Event %d', $id)) ->setName($name)
->setFullName(pht('E%d: %s', $id, $name)) ->setFullName(pht('E%d: %s', $id, $name))
->setURI('/E'.$id); ->setURI('/E'.$id);
} }

View file

@ -127,10 +127,17 @@ final class PhabricatorCalendarEventTransaction
$old = $this->getOldValue(); $old = $this->getOldValue();
$new = $this->getNewValue(); $new = $this->getNewValue();
$viewer = $this->getViewer();
$type = $this->getTransactionType(); $type = $this->getTransactionType();
switch ($type) { switch ($type) {
case self::TYPE_NAME: case self::TYPE_NAME:
if ($old) { if ($old === null) {
return pht(
'%s created %s',
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid));
} else {
return pht( return pht(
'%s changed the name of %s from %s to %s.', '%s changed the name of %s from %s to %s.',
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),
@ -141,33 +148,43 @@ final class PhabricatorCalendarEventTransaction
break; break;
case self::TYPE_START_DATE: case self::TYPE_START_DATE:
if ($old) { if ($old) {
$old = phabricator_datetime($old, $viewer);
$new = phabricator_datetime($new, $viewer);
return pht( return pht(
'%s edited the start date of this event from %s to %s.', '%s changed the start date of %s from %s to %s.',
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid),
$old, $old,
$new); $new);
} }
break; break;
case self::TYPE_END_DATE: case self::TYPE_END_DATE:
if ($old) { if ($old) {
$old = phabricator_datetime($old, $viewer);
$new = phabricator_datetime($new, $viewer);
return pht( return pht(
'%s edited the end date of this event from %s to %s.', '%s edited the end date of %s from %s to %s.',
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid),
$old, $old,
$new); $new);
} }
break; break;
case self::TYPE_STATUS: case self::TYPE_STATUS:
$old_name = PhabricatorCalendarEvent::getNameForStatus($old);
$new_name = PhabricatorCalendarEvent::getNameForStatus($new);
return pht( return pht(
'%s updated the event status from %s to %s.', '%s updated the status of %s from %s to %s.',
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),
$old, $this->renderHandleLink($object_phid),
$new); $old_name,
$new_name);
break; break;
case self::TYPE_DESCRIPTION: case self::TYPE_DESCRIPTION:
return pht( return pht(
"%s updated the event's description.", '%s updated the description of %s.',
$this->renderHandleLink($author_phid)); $this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid));
break; break;
} }