} else: activity = { 'name': activity_name, 'message': 'System ' + msg, 'data': data, 'resource': resource } if recipients: send_activity_emails(activity=activity, recipients=recipients) def get_recipients(user_list, activity_name): if not user_list and activity_name == ACTIVITY_ERROR: user_list = get_resource_service('users').get_users_by_user_type( 'administrator') recipients = [ user.get('email') for user in user_list if not user.get('needs_activation', True) and user.get('is_enabled', False) and user.get('is_active', False) and get_resource_service('preferences').email_notification_is_enabled( preferences=user.get('user_preferences', {})) ] return recipients add_notifier(notify_and_add_activity)
'name': activity_name, 'message': current_user.get('display_name') + ' ' + msg if current_user else msg, 'data': data, 'resource': resource } else: activity = { 'name': activity_name, 'message': 'System ' + msg, 'data': data, 'resource': resource } if recipients: send_activity_emails(activity=activity, recipients=recipients) def get_recipients(user_list, activity_name): if not user_list and activity_name == ACTIVITY_ERROR: user_list = get_resource_service('users').get_users_by_user_type('administrator') recipients = [user.get('email') for user in user_list if not user.get('needs_activation', True) and user.get('is_enabled', False) and user.get('is_active', False) and get_resource_service('preferences') .email_notification_is_enabled(preferences=user.get('user_preferences', {}))] return recipients add_notifier(notify_and_add_activity)