From 47f7727a4be40e0602bb01509ae3722dc5aab3dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 3 Nov 2016 12:11:57 +0100 Subject: [PATCH] Fixed issue registering activity on shotless task --- attract/tasks/eve_hooks.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/attract/tasks/eve_hooks.py b/attract/tasks/eve_hooks.py index 3e4bc60..ec0fa09 100644 --- a/attract/tasks/eve_hooks.py +++ b/attract/tasks/eve_hooks.py @@ -93,16 +93,18 @@ def _parent_name(task): def register_task_activity(task, descr): user_id = pillar.api.utils.authentication.current_user_id() - if not user_id: - log.error('Unable to register task activity %r for task %s: user_id=%s', - descr, task['_id'], user_id) - return + + context_ob = task.get('parent') + context_type = 'node' + if not context_ob: + context_type = 'project' + context_ob = task['project'] pillar.api.activities.register_activity( user_id, descr + _parent_name(task), 'node', task['_id'], - 'node', task.get('parent'), + context_type, context_ob, task['project'], node_type=task['node_type'], )