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'], )