def answer_accepted(action, new): question = action.node.question if not question.is_notifiable: return subscribers = question.subscribers.filter( subscription_settings__enable_notifications=True, subscription_settings__subscribed_questions='i' ).exclude(id=action.node.nstate.accepted.by.id).distinct() subscribers = filter_subscribers(subscribers) send_template_email(subscribers, "notifications/answeraccepted.html", {'answer': action.node}) AcceptAnswerAction.hook(answer_accepted) def member_joined(action, new): subscribers = User.objects.filter( subscription_settings__enable_notifications=True, subscription_settings__member_joins='i' ).exclude(id=action.user.id).distinct() subscribers = filter_subscribers(subscribers) send_template_email(subscribers, "notifications/newmember.html", {'newmember': action.user}) UserJoinsAction.hook(member_joined) def question_viewed(action, new):
if not question.is_notifiable: return subscribers = question.subscribers.filter( subscription_settings__enable_notifications=True, subscription_settings__subscribed_questions='i').exclude( id=action.node.nstate.accepted.by.id).distinct() subscribers = filter_subscribers(subscribers) send_template_email(subscribers, "notifications/answeraccepted.html", {'answer': action.node}) AcceptAnswerAction.hook(answer_accepted) def member_joined(action, new): subscribers = User.objects.filter( subscription_settings__enable_notifications=True, subscription_settings__member_joins='i').exclude( id=action.user.id).distinct() subscribers = filter_subscribers(subscribers) send_template_email(subscribers, "notifications/newmember.html", {'newmember': action.user}) UserJoinsAction.hook(member_joined)
def answer_accepted(action, new): question = action.node.question subscribers = question.subscribers.filter( subscription_settings__enable_notifications=True, subscription_settings__notify_accepted=True, subscription_settings__subscribed_questions='i' ).exclude(id=action.node.nstate.accepted.by.id).distinct() subscribers = filter_subscribers(subscribers) send_template_email(subscribers, "notifications/answeraccepted.html", {'answer': action.node}) AcceptAnswerAction.hook(answer_accepted) def member_joined(action, new): subscribers = User.objects.filter( subscription_settings__enable_notifications=True, subscription_settings__member_joins='i' ).exclude(id=action.user.id).distinct() subscribers = filter_subscribers(subscribers) send_template_email(subscribers, "notifications/newmember.html", {'newmember': action.user}) UserJoinsAction.hook(member_joined) def question_viewed(action, new):