From patchwork Wed Oct 16 22:44:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Herland X-Patchwork-Id: 1178206 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46tnTC1cXTz9sP3 for ; Thu, 17 Oct 2019 09:46:07 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=herland.net Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46tnTC0KKnzDqYX for ; Thu, 17 Oct 2019 09:46:07 +1100 (AEDT) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=209.85.128.52; helo=mail-wm1-f52.google.com; envelope-from=jherland@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=herland.net Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46tnRp00m4zDr6Y for ; Thu, 17 Oct 2019 09:44:51 +1100 (AEDT) Received: by mail-wm1-f52.google.com with SMTP id 5so482357wmg.0 for ; Wed, 16 Oct 2019 15:44:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+reTMeA/AZXnDO9aufQhuBYP5Owg7uvtMMosGiBWTdo=; b=O9EOQ4P41mS0hGo2G+bbpRpRPodLK9/q/2Duigji8dg+yKIAeySREci2SAUxngECVp wnzIQ7YZLpFTtoX4hWj+gRlDS8axpnIwvTnhDPt1MpnTfm3E86xHE4ikXSQeBZqyYDBK uhzz4JGzjVNugJ/bCn9fd+QprONRCvSeFGePH0/1BW6P4JNBNE58LTHDR7DDLuyigGnb 6Q3nwaxHY23jPmVhj43d6jhgznFVhA0AtRgJXLEq4RB9KxxyAgpA9Aasr4bKDwf/STPd lAVumkKOny8vVoTjQPT6qWFYwhjv90wIn63s/Xas8sUMTspJ4PyYLYKe9salod0Fj8bZ hROQ== X-Gm-Message-State: APjAAAX1QuswI2M3VZbhHGpDz65cjibrufT55ISqhnszz8R+QCRJYctT lvX92K1OZO/ufGByMqff4wdlXTMcETk= X-Google-Smtp-Source: APXvYqyOw9Qj+2mLqoiXyfEhSPVPTEuquK606731j3H8qifLDDurgSfFiIQKnMSC3MgBE5g1FOyGLA== X-Received: by 2002:a1c:dc83:: with SMTP id t125mr64393wmg.50.1571265887012; Wed, 16 Oct 2019 15:44:47 -0700 (PDT) Received: from beta.cisco.com ([173.38.220.34]) by smtp.gmail.com with ESMTPSA id w4sm198364wrv.66.2019.10.16.15.44.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Oct 2019 15:44:46 -0700 (PDT) From: Johan Herland To: patchwork@lists.ozlabs.org Subject: [PATCH v3 0/3] Store the 'actor' responsible for events Date: Thu, 17 Oct 2019 00:44:39 +0200 Message-Id: <20191016224442.9211-1-johan@herland.net> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" 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. The need for this enhancement is also documented in Issue #73. This patch series adds an 'actor' field to the Event model, and - for applicable events - stores the user responsible for that event (i.e. the current/active user, if any) into this field. This applies to the following events: - patch-created - patch-completed - patch-state-changed - patch-delegated - series-completed - check-created For the other events (cover-created and series-created), I could not easily determine if there is a responsible user at all, as these events are typically generated in response to incoming emails. In these cases (and any other scenario where we cannot find the active/current user) the Event.actor field is left as null/None. Finally, the new Event.actor field is exposed in the events view of the REST API (as of API version 1.2). Changes since v2: - Update docs/usage/overview.rst - Acked-by: Daniel Have fun! ...Johan Johan Herland (3): models.Event: Add the user responsible for the event Include the responsible actor in applicable events /api/events: Add 'actor' field to generated JSON docs/api/schemas/latest/patchwork.yaml | 6 ++++++ docs/api/schemas/patchwork.j2 | 8 ++++++++ docs/api/schemas/v1.2/patchwork.yaml | 6 ++++++ docs/usage/overview.rst | 3 +++ patchwork/api/event.py | 10 +++++++--- patchwork/migrations/0037_event_actor.py | 21 +++++++++++++++++++++ patchwork/models.py | 10 +++++++++- patchwork/signals.py | 10 ++++++++-- patchwork/tests/api/test_event.py | 24 ++++++++++++++++++++++++ patchwork/tests/test_events.py | 7 +++++++ 10 files changed, 99 insertions(+), 6 deletions(-) create mode 100644 patchwork/migrations/0037_event_actor.py