def get_notification_data(notifications): """Get notification data for all notifications. This function returns a filtered data for all notifications for the users that should receive it. Args: notifications (list of Notification): List of notification for which we want to get notification data. Returns: dict: Filtered dictionary containing all the data that should be sent for the given notification list. """ if not notifications: return {} aggregate_data = {} people_cache = {} tasks_cache = cycle_tasks_cache(notifications) deleted_rels_cache = deleted_task_rels_cache(tasks_cache.keys()) for notification in notifications: filtered_data = get_filter_data(notification, people_cache, tasks_cache=tasks_cache, del_rels_cache=deleted_rels_cache) aggregate_data = merge_dict(aggregate_data, filtered_data) # Remove notifications for objects without a contact (such as task groups) aggregate_data.pop("", None) return aggregate_data
def get_notification_data(notifications): """Get notification data for all notifications. This function returns a filtered data for all notifications for the users that should receive it. Args: notifications (list of Notification): List of notification for which we want to get notification data. Returns: dict: Filtered dictionary containing all the data that should be sent for the given notification list. """ if not notifications: return {} aggregate_data = {} people_cache = {} tasks_cache = cycle_tasks_cache(notifications) deleted_rels_cache = deleted_task_rels_cache(tasks_cache.keys()) for notification in notifications: filtered_data = get_filter_data( notification, people_cache, tasks_cache=tasks_cache, del_rels_cache=deleted_rels_cache) aggregate_data = merge_dict(aggregate_data, filtered_data) # Remove notifications for objects without a contact (such as task groups) aggregate_data.pop("", None) sort_comments(aggregate_data) return aggregate_data