From 3272008aef1f97916898eaebe0286c2de3393a36 Mon Sep 17 00:00:00 2001 From: Jason Ge Date: Sun, 19 Jun 2011 00:27:39 -0700 Subject: [PATCH] Create timeline event for revision creation Summary: create the event Test Plan: checked the timeline event was consumed successfully by facebook daemon when the revision is created from the webUI or arc command line. Reviewed By: epriestley Reviewers: epriestley, aran CC: aran, epriestley Differential Revision: 478 --- .../revision/DifferentialRevisionEditor.php | 16 ++++++++++++++++ .../differential/editor/revision/__init__.php | 2 ++ 2 files changed, 18 insertions(+) diff --git a/src/applications/differential/editor/revision/DifferentialRevisionEditor.php b/src/applications/differential/editor/revision/DifferentialRevisionEditor.php index d095e4dbcf..01ff614cc4 100644 --- a/src/applications/differential/editor/revision/DifferentialRevisionEditor.php +++ b/src/applications/differential/editor/revision/DifferentialRevisionEditor.php @@ -359,6 +359,22 @@ class DifferentialRevisionEditor { $revision->save(); + $event_data = array( + 'revision_id' => $revision->getID(), + 'revision_phid' => $revision->getPHID(), + 'revision_name' => $revision->getTitle(), + 'revision_author_phid' => $revision->getAuthorPHID(), + 'action' => $is_new + ? DifferentialAction::ACTION_CREATE + : DifferentialAction::ACTION_UPDATE, + 'feedback_content' => $is_new + ? '' + : $this->getComments(), + 'actor_phid' => $revision->getAuthorPHID(), + ); + id(new PhabricatorTimelineEvent('difx', $event_data)) + ->recordEvent(); + // TODO // $revision->saveTransaction(); diff --git a/src/applications/differential/editor/revision/__init__.php b/src/applications/differential/editor/revision/__init__.php index e5703a1cb1..7cb47b118b 100644 --- a/src/applications/differential/editor/revision/__init__.php +++ b/src/applications/differential/editor/revision/__init__.php @@ -6,6 +6,7 @@ +phutil_require_module('phabricator', 'applications/differential/constants/action'); phutil_require_module('phabricator', 'applications/differential/constants/revisionstatus'); phutil_require_module('phabricator', 'applications/differential/mail/ccwelcome'); phutil_require_module('phabricator', 'applications/differential/mail/newdiff'); @@ -16,6 +17,7 @@ phutil_require_module('phabricator', 'applications/herald/engine/engine'); phutil_require_module('phabricator', 'applications/herald/storage/transcript/base'); phutil_require_module('phabricator', 'applications/phid/handle/data'); phutil_require_module('phabricator', 'applications/search/index/indexer/differential'); +phutil_require_module('phabricator', 'infrastructure/daemon/timeline/storage/event'); phutil_require_module('phabricator', 'infrastructure/env'); phutil_require_module('phabricator', 'storage/qsprintf'); phutil_require_module('phabricator', 'storage/queryfx');