Example #1
0
def send_award_message(sender, instance, created, **kwargs):
    """
    Send message to users when they receive an award.
    """
    if created:
        template = "messages/awards_created.md"
        context = dict(award=instance)
        # Send local message
        tasks.create_messages(template=template, extra_context=context, rec_list=[instance.user])

    return
Example #2
0
def send_award_message(sender, instance, created, **kwargs):
    """
    Send message to users when they receive an award.
    """
    if created:
        template = "messages/awards_created.md"
        context = dict(award=instance)

        # Temporarily stop messages to high rep users.
        if instance.user.profile.score < 1000:
            # Send local message
            tasks.create_messages(template=template, extra_context=context, user_ids=[instance.user.pk])

    return
Example #3
0
def send_award_message(sender, instance, created, **kwargs):
    """
    Send message to users when they receive an award.
    """
    if created:
        template = "messages/shared_link.md"
        context = dict(shared=instance)

        # Let the user know we have received.
        tasks.create_messages(template=template,
                              extra_context=context,
                              user_ids=[instance.author.pk])

    return
Example #4
0
def send_herald_message(sender, instance, created, **kwargs):
    """
    Send message to users when they receive an award.
    """
    if created:
        template = "messages/shared_link.md"
        context = dict(shared=instance)

        # Let the user know we have received.
        tasks.create_messages(template=template,
                              extra_context=context,
                              user_ids=[instance.author.pk])
        logmsg = f"{instance.get_status_display().lower()} herald story {instance.url[:100]}"
        auth.db_logger(user=instance.author, text=logmsg)

    return