More detailed "verb" for task action logging.
This commit is contained in:
@@ -51,6 +51,11 @@ def index():
|
||||
act.project = id_to_proj[act.project]
|
||||
|
||||
if act.node_type == node_type_task_name:
|
||||
if act.context_object:
|
||||
act.link = url_for('attract.shots.perproject.with_task',
|
||||
project_url=act.project.url,
|
||||
task_id=act.object)
|
||||
else:
|
||||
act.link = url_for('attract.tasks.perproject.view_task',
|
||||
project_url=act.project.url,
|
||||
task_id=act.object)
|
||||
|
@@ -70,13 +70,28 @@ def fetch_tasks_parent_info(nodes):
|
||||
fetch_task_extra_info(node)
|
||||
|
||||
|
||||
# Activity logging
|
||||
# ### Activity logging ### #
|
||||
def _parent_name(task):
|
||||
"""Returns 'for shot "shotname"' if the task is attached to the shot."""
|
||||
|
||||
parent = task.get('parent')
|
||||
if not parent:
|
||||
return ''
|
||||
|
||||
nodes_coll = current_app.db()['nodes']
|
||||
shot = nodes_coll.find_one(parent)
|
||||
if shot:
|
||||
return ' for shot "%s"' % shot['name']
|
||||
|
||||
return ''
|
||||
|
||||
|
||||
@only_for_task
|
||||
def activity_after_replacing_task(task, original):
|
||||
user_id = pillar.api.utils.authentication.current_user_id()
|
||||
pillar.api.activities.register_activity(
|
||||
user_id,
|
||||
'edited task',
|
||||
('edited task "%s"' % task['name']) + _parent_name(task),
|
||||
'node', task['_id'],
|
||||
'project', task['project'],
|
||||
task['project'],
|
||||
@@ -87,11 +102,12 @@ def activity_after_replacing_task(task, original):
|
||||
@only_for_task
|
||||
def activity_after_creating_task(task):
|
||||
user_id = pillar.api.utils.authentication.current_user_id()
|
||||
|
||||
pillar.api.activities.register_activity(
|
||||
user_id,
|
||||
'created a new task',
|
||||
('created a new task "%s"' % task['name']) + _parent_name(task),
|
||||
'node', task['_id'],
|
||||
'project', task['project'],
|
||||
'node', task.get('parent'),
|
||||
task['project'],
|
||||
node_type=task['node_type'],
|
||||
)
|
||||
@@ -107,7 +123,7 @@ def activity_after_deleting_task(task):
|
||||
user_id = pillar.api.utils.authentication.current_user_id()
|
||||
pillar.api.activities.register_activity(
|
||||
user_id,
|
||||
'deleted task',
|
||||
('deleted task "%s"' % task['name']) + _parent_name(task),
|
||||
'node', task['_id'],
|
||||
'project', task['project'],
|
||||
task['project'],
|
||||
|
@@ -12,9 +12,6 @@
|
||||
| {% include "attract/index_anon_left_column.html" %}
|
||||
| {% endif %}
|
||||
.col-md-6
|
||||
h3 Latest Edit
|
||||
img.img-responsive(src="//placehold.it/500x250")
|
||||
|
||||
.d-activity
|
||||
h3 Activity
|
||||
|
||||
@@ -23,7 +20,7 @@
|
||||
li
|
||||
span.date {{ act._created | pretty_date_time }}:
|
||||
a(href="{{ act.link }}")
|
||||
| {{ act['actor_user']['full_name'] }} {{ act.verb }} {{ act.object }}
|
||||
| {{ act['actor_user']['full_name'] }} {{ act.verb }}
|
||||
| {% endfor %}
|
||||
|
||||
h3 Shot statistics
|
||||
|
Reference in New Issue
Block a user