From d9c91f857cefe9167ac668966b60534a55f2e5d5 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 30 Oct 2016 08:21:12 -0700 Subject: [PATCH] Apply a TYPE_CREATE transaction when importing events to improve strings in timeline Summary: Ref T10747. This turns on the newer EditEngine behavior so we get a nice "X created this event." transaction, instead of an "X renamed this from to Event Name." Test Plan: Imported an event, saw a nice timeline. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10747 Differential Revision: https://secure.phabricator.com/D16771 --- .../calendar/editor/PhabricatorCalendarEventEditor.php | 9 +++++++++ .../calendar/import/PhabricatorCalendarImportEngine.php | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php index d22d34bee7..bf63d8e8e7 100644 --- a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php +++ b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php @@ -11,6 +11,15 @@ final class PhabricatorCalendarEventEditor return pht('Calendar'); } + public function getCreateObjectTitle($author, $object) { + return pht('%s created this event.', $author); + } + + public function getCreateObjectTitleForFeed($author, $object) { + return pht('%s created %s.', $author, $object); + } + + protected function shouldApplyInitialEffects( PhabricatorLiskDAO $object, array $xactions) { diff --git a/src/applications/calendar/import/PhabricatorCalendarImportEngine.php b/src/applications/calendar/import/PhabricatorCalendarImportEngine.php index 1bb7df46d2..96069e0ee1 100644 --- a/src/applications/calendar/import/PhabricatorCalendarImportEngine.php +++ b/src/applications/calendar/import/PhabricatorCalendarImportEngine.php @@ -471,6 +471,12 @@ abstract class PhabricatorCalendarImportEngine $xactions = array(); $uid = $node->getUID(); + if (!$event->getID()) { + $xactions[] = id(new PhabricatorCalendarEventTransaction()) + ->setTransactionType(PhabricatorTransactions::TYPE_CREATE) + ->setNewValue(true); + } + $name = $node->getName(); if (!strlen($name)) { if (strlen($uid)) {