Adding extra info to timeline API
parent
c77ee9f0ad
commit
c5b268aa75
|
@ -225,3 +225,10 @@ def extract_wiki_page_info(instance):
|
|||
"id": instance.pk,
|
||||
"slug": instance.slug,
|
||||
}
|
||||
|
||||
|
||||
def extract_role_info(instance):
|
||||
return {
|
||||
"id": instance.pk,
|
||||
"name": instance.name,
|
||||
}
|
||||
|
|
|
@ -95,6 +95,7 @@ def on_new_history_entry(sender, instance, created, **kwargs):
|
|||
"values_diff": instance.values_diff,
|
||||
"user": extract_user_info(user),
|
||||
"comment": instance.comment,
|
||||
"comment_html": instance.comment_html,
|
||||
}
|
||||
|
||||
_push_to_timelines(project, user, obj, event_type, extra_data=extra_data)
|
||||
|
|
|
@ -94,10 +94,11 @@ def wiki_page_timeline(instance, extra_data={}):
|
|||
|
||||
@register_timeline_implementation("projects.membership", "create")
|
||||
@register_timeline_implementation("projects.membership", "delete")
|
||||
def membership_create_timeline(instance, extra_data={}):
|
||||
def membership_timeline(instance, extra_data={}):
|
||||
result = {
|
||||
"user": service.extract_user_info(instance.user),
|
||||
"project": service.extract_project_info(instance.project),
|
||||
"role": service.extract_role_info(instance.role),
|
||||
}
|
||||
result.update(extra_data)
|
||||
return result
|
||||
|
|
Loading…
Reference in New Issue