Exemple #1
0
def prepare_place_conversation_message_notification(user, message):
    conversation = message.conversation
    place = conversation.target

    from_text = message.author.display_name
    reply_to_name = place.name
    conversation_name = place.name

    local_part = make_local_part(conversation, user, message)
    reply_to = formataddr(
        (reply_to_name, '{}@{}'.format(local_part,
                                       settings.SPARKPOST_RELAY_DOMAIN)))
    from_email = formataddr((from_text, settings.DEFAULT_FROM_EMAIL))

    unsubscribe_url = conversation_unsubscribe_url(user,
                                                   group=place.group,
                                                   conversation=conversation)

    return prepare_email(
        template='conversation_message_notification',
        from_email=from_email,
        user=user,
        tz=place.group.timezone,
        reply_to=[reply_to],
        unsubscribe_url=unsubscribe_url,
        context={
            'messages': [message],
            'conversation_name': conversation_name,
            'conversation_url': place_wall_url(place),
            'mute_url': unsubscribe_url,
        },
        stats_category='place_conversation_message',
    )
Exemple #2
0
def prepare_place_conversation_message_notification(user, message):
    conversation = message.conversation
    place = conversation.target
    reply_to_name = place.name
    conversation_name = place.name
    with translation.override(language_for_user(user)):
        return prepare_message_notification(
            user,
            messages=[message],
            group=place.group,
            reply_to_name=reply_to_name,
            conversation_name=conversation_name,
            conversation_url=place_wall_url(place),
            stats_category='place_conversation_message')