From 0146b568c0ff798da4e010a50548cd03cd9745a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Wed, 12 Oct 2016 14:29:28 +0200 Subject: [PATCH] Allow extra fields in activities. --- pillar/api/activities.py | 3 ++- pillar/api/eve_settings.py | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pillar/api/activities.py b/pillar/api/activities.py index 71ea2a7f..dad3b2cc 100644 --- a/pillar/api/activities.py +++ b/pillar/api/activities.py @@ -153,7 +153,7 @@ def activity_object_add(actor_user_id, verb, object_type, object_id, def register_activity(actor_user_id, verb, object_type, object_id, context_object_type, context_object_id, - project_id=None): + project_id=None, **extra_fields): """Registers an activity. This works using the following pattern: @@ -183,6 +183,7 @@ def register_activity(actor_user_id, verb, object_type, object_id, 'context_object': context_object_id} if project_id: activity['project'] = project_id + activity.update(extra_fields) info, _, _, status_code = current_app.post_internal('activities', activity) diff --git a/pillar/api/eve_settings.py b/pillar/api/eve_settings.py index 972ca0b3..780e23d8 100644 --- a/pillar/api/eve_settings.py +++ b/pillar/api/eve_settings.py @@ -684,6 +684,11 @@ activities_schema = { }, 'required': False, }, + # If the object type is 'node', the node type can be stored here. + 'node_type': { + 'type': 'string', + 'required': False, + } } notifications_schema = {