def trigger_new_session_notifications(session_id, event_id=None, event=None): if not event and not event_id: raise Exception('event or event_id is required') if not event: event = DataGetter.get_event(event_id) link = url_for('event_sessions.session_display_view', event_id=event.id, session_id=session_id, _external=True) admin_msg_setting = DataGetter.get_message_setting_by_action(NEW_SESSION) organizers = DataGetter.get_user_event_roles_by_role_name( event.id, 'organizer') for organizer in organizers: email_notification_setting = DataGetter.get_email_notification_settings_by_event_id( organizer.user.id, event_id) if not admin_msg_setting or \ (email_notification_setting and email_notification_setting.new_paper == 1 and admin_msg_setting.user_control_status == 1) or \ admin_msg_setting.user_control_status == 0: send_new_session_organizer(organizer.user.email, event.name, link) # Send notification print " notif Sending" send_notif_new_session_organizer(organizer.user, event.name, link)
def trigger_new_session_notifications(session_id, event_id=None, event=None): if not event and not event_id: raise Exception('event or event_id is required') if not event: event = DataGetter.get_event(event_id) link = url_for('event_sessions.session_display_view', event_id=event.id, session_id=session_id, _external=True) organizers = DataGetter.get_user_event_roles_by_role_name(event_id, 'organizer') for organizer in organizers: email_notification_setting = DataGetter.get_email_notification_settings_by_event_id(organizer.user.id, event_id) if email_notification_setting and email_notification_setting.new_paper == 1: send_new_session_organizer(organizer.user.email, event.name, link) # Send notification send_notif_new_session_organizer(organizer.user, event.name, link)
def trigger_new_session_notifications(session_id, event_id=None, event=None): if not event and not event_id: raise Exception('event or event_id is required') if not event: event = DataGetter.get_event(event_id) link = url_for('event_sessions.session_display_view', event_id=event.id, session_id=session_id, _external=True) admin_msg_setting = DataGetter.get_message_setting_by_action(NEW_SESSION) organizers = DataGetter.get_user_event_roles_by_role_name(event.id, 'organizer') for organizer in organizers: email_notification_setting = DataGetter.get_email_notification_settings_by_event_id(organizer.user.id, event.id) if not admin_msg_setting or \ (email_notification_setting and email_notification_setting.new_paper == 1 and admin_msg_setting.user_control_status == 1) or admin_msg_setting.user_control_status == 0: send_new_session_organizer(organizer.user.email, event.name, link) # Send notification send_notif_new_session_organizer(organizer.user, event.name, link)