Send event to stream when draft change is published

When a change is uploaded as a draft, a `patchset-created` event is
sent to the event stream, but since drafts are private to the owner,
the event is not publicly visible.  Furthermore, when the draft is
later published, no publicly visible event is sent.

The result of this is that external tools that rely on the event stream
to detect new changes will not receive events for any changes that are
first uploaded as draft.

This patch adds a new event, `draft-published`, which is sent to the
event stream when a draft change is published.  The content of this
event is the same as `patchset-created`.

Bug: Issue 1437
Change-Id: I72f6dde99a82253ba796c1c13226a8b33f0e82bf
This commit is contained in:
David Pursehouse
2012-06-12 18:34:37 +09:00
committed by Shawn O. Pearce
parent e11af58719
commit d556c19fbd
8 changed files with 117 additions and 8 deletions

View File

@@ -43,8 +43,8 @@ SCHEMA
The JSON messages consist of nested objects referencing the *change*,
*patchSet*, *account* involved, and other attributes as appropriate.
The currently supported message types are *patchset-created*,
*change-abandoned*, *change-restored*, *change-merged*,
*comment-added* and *ref-updated*.
*draft-published*, *change-abandoned*, *change-restored*,
*change-merged*, *comment-added* and *ref-updated*.
Note that any field may be missing in the JSON messages, so consumers of
this JSON stream should deal with that appropriately.
@@ -61,6 +61,16 @@ patchSet:: link:json.html#patchSet[patchSet attribute]
uploader:: link:json.html#account[account attribute]
Draft Published
^^^^^^^^^^^^^^^
type:: "draft-published"
change:: link:json.html#change[change attribute]
patchset:: link:json.html#patchset[patchset attribute]
uploader:: link:json.html#account[account attribute]
Change Abandoned
^^^^^^^^^^^^^^^^
type:: "change-abandoned"