[PATCH 0/3] Store the user responsible for patch-related events

Johan Herland johan at herland.net
Mon Oct 7 09:57:22 AEDT 2019


The V4L project (https://patchwork.linuxtv.org) uses patch states and
delegates extensively to track progress. We want an audit log to keep
track of the changes made to these patch fields. The Event model already
records this information, but leaves out one crucial detail: which
maintainer/user actually updated the patch state/delegate.

This patch series adds a 'user' field to the Event model, and - when an
event is generated as a result of Patch.save() - stores the active user
(i.e. the user responsible for the .save(), if available) into the event
object. This applies to the following patch-related events:
 - patch-created
 - patch-completed
 - patch-state-changed
 - patch-delegated
 - series-completed

For the other events (cover-created, check-created, and series-created),
I could not easily determine the responsible user (or if there is one at
all), so in these cases the Event.user field is left as null/None.

Finally, the new Event.user field is exposed in the events view of the
REST API.

(First time submitter to this project, so please tell me if I overlooked
something.)


Have fun!
...Johan


Johan Herland (3):
  models.Event: Add the user responsible for the event
  Include the responsible user in patch-related events
  /api/events: Add 'user' field to generated JSON

 docs/api/schemas/latest/patchwork.yaml  |  6 ++++++
 docs/api/schemas/patchwork.j2           |  6 ++++++
 docs/api/schemas/v1.0/patchwork.yaml    |  6 ++++++
 docs/api/schemas/v1.1/patchwork.yaml    |  6 ++++++
 docs/api/schemas/v1.2/patchwork.yaml    |  6 ++++++
 patchwork/api/event.py                  | 10 +++++++---
 patchwork/migrations/0037_event_user.py | 23 +++++++++++++++++++++++
 patchwork/models.py                     | 10 +++++++++-
 patchwork/signals.py                    |  9 +++++++--
 patchwork/tests/api/test_event.py       |  7 +++++++
 patchwork/tests/test_events.py          |  6 ++++++
 11 files changed, 89 insertions(+), 6 deletions(-)
 create mode 100644 patchwork/migrations/0037_event_user.py

-- 
2.19.2



More information about the Patchwork mailing list