From 0908781f6c4855f1f5406bccb1136df409c7df4b Mon Sep 17 00:00:00 2001 From: Yolanda Robla Date: Fri, 21 Nov 2014 15:30:32 +0100 Subject: [PATCH] Add details to event subscription Stories events did not have details for event subscription. Tasks were missing story id so we could not link to the story which the task belonged to. Change-Id: I523d5f778f62b1aa80294bb05839bb2fab50d5b6 --- storyboard/api/v1/stories.py | 5 +++-- storyboard/db/api/timeline_events.py | 20 ++++++++++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/storyboard/api/v1/stories.py b/storyboard/api/v1/stories.py index 64c8158e..ee645748 100644 --- a/storyboard/api/v1/stories.py +++ b/storyboard/api/v1/stories.py @@ -123,7 +123,7 @@ class StoriesController(rest.RestController): story_dict.update({"creator_id": user_id}) created_story = stories_api.story_create(story_dict) - events_api.story_created_event(created_story.id, user_id) + events_api.story_created_event(created_story.id, user_id, story.title) return wmodels.Story.from_db_model(created_story) @@ -141,7 +141,8 @@ class StoriesController(rest.RestController): if updated_story: user_id = request.current_user_id - events_api.story_details_changed_event(story_id, user_id) + events_api.story_details_changed_event(story_id, user_id, + story.title) return wmodels.Story.from_db_model(updated_story) else: diff --git a/storyboard/db/api/timeline_events.py b/storyboard/db/api/timeline_events.py index b89fde1d..833d21d8 100644 --- a/storyboard/db/api/timeline_events.py +++ b/storyboard/db/api/timeline_events.py @@ -59,24 +59,35 @@ def event_create(values): return new_event -def story_created_event(story_id, author_id): +def story_created_event(story_id, author_id, story_title): + event_info = { + "story_id": story_id, + "story_title": story_title + } return event_create({ "story_id": story_id, "author_id": author_id, "event_type": event_types.STORY_CREATED, + "event_info": json.dumps(event_info) }) -def story_details_changed_event(story_id, author_id): +def story_details_changed_event(story_id, author_id, story_title): + event_info = { + "story_id": story_id, + "story_title": story_title + } return event_create({ "story_id": story_id, "author_id": author_id, "event_type": event_types.STORY_DETAILS_CHANGED, + "event_info": json.dumps(event_info) }) def task_created_event(story_id, task_id, task_title, author_id): event_info = { + "story_id": story_id, "task_id": task_id, "task_title": task_title } @@ -91,6 +102,7 @@ def task_created_event(story_id, task_id, task_title, author_id): def task_status_changed_event(story_id, task_id, task_title, author_id, old_status, new_status): event_info = { + "story_id": story_id, "task_id": task_id, "task_title": task_title, "old_status": old_status, @@ -107,6 +119,7 @@ def task_status_changed_event(story_id, task_id, task_title, author_id, def task_priority_changed_event(story_id, task_id, task_title, author_id, old_priority, new_priority): event_info = { + "story_id": story_id, "task_id": task_id, "task_title": task_title, "old_priority": old_priority, @@ -123,6 +136,7 @@ def task_priority_changed_event(story_id, task_id, task_title, author_id, def task_assignee_changed_event(story_id, task_id, task_title, author_id, old_assignee_id, new_assignee_id): event_info = { + "story_id": story_id, "task_id": task_id, "task_title": task_title, "old_assignee_id": old_assignee_id, @@ -138,6 +152,7 @@ def task_assignee_changed_event(story_id, task_id, task_title, author_id, def task_details_changed_event(story_id, task_id, task_title, author_id): event_info = { + "story_id": story_id, "task_id": task_id, "task_title": task_title } @@ -151,6 +166,7 @@ def task_details_changed_event(story_id, task_id, task_title, author_id): def task_deleted_event(story_id, task_id, task_title, author_id): event_info = { + "story_id": story_id, "task_id": task_id, "task_title": task_title }