Example #1
0
def bounty_feedback(bounty, persona='fulfiller', previous_bounties=None):
    from_email = settings.PERSONAL_CONTACT_EMAIL
    to_email = None
    cur_language = translation.get_language()
    if previous_bounties is None:
        previous_bounties = []

    try:
        setup_lang(to_email)
        if persona == 'fulfiller':
            accepted_fulfillments = bounty.fulfillments.filter(accepted=True)
            to_email = accepted_fulfillments.first().fulfiller_email if accepted_fulfillments.exists() else ""
        elif persona == 'funder':
            to_email = bounty.bounty_owner_email

        subject = bounty.github_url
        __, text = render_bounty_feedback(bounty, persona, previous_bounties)
        cc_emails = [from_email, '*****@*****.**']
        if not should_suppress_notification_email(to_email, 'bounty_feedback'):
            send_mail(
                from_email,
                to_email,
                subject,
                text,
                cc_emails=cc_emails,
                from_name="Kevin Owocki (Gitcoin.co)",
                categories=['transactional', func_name()],
            )
    finally:
        translation.activate(cur_language)
Example #2
0
def bounty_feedback(bounty, persona='submitter', previous_bounties=[]):
    from_email = settings.PERSONAL_CONTACT_EMAIL
    to_email = bounty.bounty_owner_email
    if persona != 'submitter':
        accepted_fulfillments = bounty.fulfillments.filter(accepted=True)
        to_email = accepted_fulfillments.first().fulfiller_email if accepted_fulfillments.exists() else ""

    subject = bounty.github_url
    html, text = render_bounty_feedback(bounty, persona, previous_bounties)
    cc_emails = [from_email]
    send_mail(from_email, to_email, subject, text, cc_emails=cc_emails, from_name="Kevin Owocki (Gitcoin.co)")
Example #3
0
def bounty_feedback(bounty, persona='fulfiller', previous_bounties=None):
    from_email = '*****@*****.**'
    to_email = None
    cur_language = translation.get_language()
    if previous_bounties is None:
        previous_bounties = []

    try:
        setup_lang(to_email)
        if persona == 'fulfiller':
            accepted_fulfillments = bounty.fulfillments.filter(accepted=True)
            to_email = accepted_fulfillments.first(
            ).fulfiller_email if accepted_fulfillments.exists() else ""
        elif persona == 'funder':
            to_email = bounty.bounty_owner_email
            if not to_email:
                if bounty.bounty_owner_profile:
                    to_email = bounty.bounty_owner_profile.email
            if not to_email:
                if bounty.bounty_owner_profile and bounty.bounty_owner_profile.user:
                    to_email = bounty.bounty_owner_profile.user.email
        if not to_email:
            return

        subject = bounty.github_url
        __, text = render_bounty_feedback(bounty, persona, previous_bounties)
        cc_emails = [from_email, '*****@*****.**']
        if not should_suppress_notification_email(to_email, 'bounty_feedback'):
            send_mail(
                from_email,
                to_email,
                subject,
                text,
                cc_emails=cc_emails,
                from_name="Alisa March (Gitcoin.co)",
                categories=['transactional', func_name()],
            )
    finally:
        translation.activate(cur_language)