-
-
Notifications
You must be signed in to change notification settings - Fork 775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: email setup no applicant bounty #5062
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
''' | ||
Copyright (C) 2019 Gitcoin Core | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published | ||
by the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
|
||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
''' | ||
from django.conf import settings | ||
from django.core.management.base import BaseCommand | ||
from django.db.models import Q | ||
from django.utils import timezone | ||
|
||
from dashboard.models import Bounty | ||
from marketing.mails import no_applicant_reminder | ||
|
||
|
||
class Command(BaseCommand): | ||
|
||
help = 'sends reminder emails to funders whose bounties have 0 applications' | ||
thelostone-mc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
def handle(self, *args, **options): | ||
if settings.DEBUG: | ||
print("not active in non prod environments") | ||
return | ||
|
||
start_time_3_days = timezone.now() - timezone.timedelta(hours=24 * 3) | ||
end_time_3_days = timezone.now() - timezone.timedelta(hours=24 * 4) | ||
|
||
start_time_7_days = timezone.now() - timezone.timedelta(hours=24 * 7) | ||
end_time_7_days = timezone.now() - timezone.timedelta(hours=24 * 8) | ||
bounties = Bounty.objects.current().filter( | ||
network='mainnet', | ||
(Q(created_on__range=[end_time_3_days, start_time_3_days]) | Q(created_on__range=[end_time_7_days, start_time_7_days])) | ||
idx_status='open', | ||
) | ||
|
||
for bounty in [b for b in bounties if b.no_of_applicants == 0]: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cool this will solve contest bounties. |
||
no_applicant_reminder(bounty.bounty_owner_email, bounty) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -308,7 +308,6 @@ def render_quarterly_stats(to_email, platform_wide_stats): | |
params = {**quarterly_stats, **platform_wide_stats} | ||
params['profile'] = profile | ||
params['subscriber'] = get_or_save_email_subscriber(to_email, 'internal'), | ||
print(params) | ||
response_html = premailer_transform(render_to_string("emails/quarterly_stats.html", params)) | ||
response_txt = render_to_string("emails/quarterly_stats.txt", params) | ||
|
||
|
@@ -322,6 +321,16 @@ def render_funder_payout_reminder(**kwargs): | |
return response_html, response_txt | ||
|
||
|
||
def render_no_applicant_reminder(bounty): | ||
params = { | ||
'bounty': bounty, | ||
'directory_link': '/users?skills=' + bounty.keywords.lower() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @octavioamu / @PixelantDesign so if the bounty has keywords We could match this against an exhaustive list at our end but even then we would end up with 3 skillm There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think is ok, since the skills needed are that. The users search will open without results and then the user can remove skills and filter new stuff to match the ones he need. |
||
} | ||
response_html = premailer_transform(render_to_string("emails/bounty/no_applicant_reminder.html", params)) | ||
response_txt = render_to_string("emails/bounty/no_applicant_reminder.txt", params) | ||
return response_html, response_txt | ||
|
||
|
||
def render_bounty_feedback(bounty, persona='submitter', previous_bounties=[]): | ||
previous_bounties_str = ", ".join([bounty.github_url for bounty in previous_bounties]) | ||
if persona == 'fulfiller': | ||
|
@@ -954,8 +963,8 @@ def render_new_bounty_roundup(to_email): | |
'url': 'https://github.com/ethresearch/eth-wiki/issues/9', | ||
'primer': 'Correcting Merkle Patricia Trie Example', | ||
}, ] | ||
|
||
|
||
num_leadboard_items = 5 | ||
highlight_kudos_ids = [] | ||
num_kudos_to_show = 15 | ||
|
@@ -1163,6 +1172,26 @@ def funder_payout_reminder(request): | |
response_html, _ = render_funder_payout_reminder(bounty=bounty, github_username=github_username) | ||
return HttpResponse(response_html) | ||
|
||
|
||
@staff_member_required | ||
def no_applicant_reminder(request): | ||
"""Display the no applicant for bounty reminder email template. | ||
|
||
Params: | ||
username (str): The Github username to reference in the email. | ||
|
||
Returns: | ||
HttpResponse: The HTML version of the templated HTTP response. | ||
|
||
""" | ||
from dashboard.models import Bounty | ||
bounty = Bounty.objects.filter( | ||
idx_status='open', current_bounty=True, interested__isnull=True | ||
).first() | ||
response_html, _ = render_no_applicant_reminder(bounty=bounty) | ||
return HttpResponse(response_html) | ||
|
||
|
||
@staff_member_required | ||
def funder_stale(request): | ||
"""Display the stale funder email template. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
{% extends 'emails/template.html' %} | ||
{% comment %} | ||
Copyright (C) 2019 Gitcoin Core | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published | ||
by the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
|
||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
{% endcomment %} | ||
{% load i18n humanize %} | ||
|
||
{% block content %} | ||
|
||
<style> | ||
h1 { | ||
font-size: 2rem; | ||
} | ||
|
||
h2 a { | ||
color: black; | ||
text-decoration: none; | ||
font-size: 1.5rem; | ||
font-weight: 300; | ||
} | ||
|
||
p { | ||
font-size: 1.1rem; | ||
font-weight: 300; | ||
max-width: 35rem; | ||
line-height: 25px; | ||
margin-left: auto; | ||
margin-right: auto; | ||
} | ||
|
||
.tag.token { | ||
background-color: #e7f0fa; | ||
color: #3E00FF; | ||
} | ||
|
||
.tag.usd { | ||
background-color: #d6fbeb; | ||
color: #00A55E; | ||
} | ||
|
||
.tag { | ||
text-align: center; | ||
margin: 4px; | ||
border-radius: 2px; | ||
padding: 3px 12px; | ||
cursor: pointer; | ||
white-space: nowrap; | ||
display: inline-block; | ||
} | ||
|
||
.tag p { | ||
font-weight: 500; | ||
font-size: 0.85rem; | ||
margin: 0; | ||
} | ||
|
||
.bounty-box { | ||
max-width: 50rem; | ||
} | ||
|
||
.btn-container { | ||
margin-top: 4rem; | ||
} | ||
</style> | ||
|
||
<div class="bounty-box"> | ||
<h1>Get more applicants on your bounty</h2> | ||
|
||
<p class="mb-0 mt-4">We noticed you dont have any contributors on your bounty.</p> | ||
<p class="mt-1"> | ||
Go to the Users Directory to discover and invite the best contributors | ||
for your bounty! | ||
</p> | ||
|
||
{% if bounty %} | ||
<img class="rounded mt-3" src="{{ bounty.avatar_url }}" width="100" height="100"> | ||
|
||
<h2> | ||
<a href="{{ bounty.absolute_url }}"> | ||
{{ bounty.title }} | ||
</a> | ||
</h2> | ||
|
||
<div class="tag token"> | ||
<p> | ||
<span>{{ bounty.token_name }}</span> | ||
<span>{{ bounty.value_true }}</span> | ||
</p> | ||
</div> | ||
|
||
<div class="tag usd"> | ||
<p> | ||
<span>{{ bounty.value_in_usdt_now }}</span> | ||
<span>USD</span> | ||
</p> | ||
</div> | ||
|
||
{% endif %} | ||
|
||
<p class="btn-container"> | ||
<a class="button" href="{{ directory_link }}">GO TO USERS DIRECTORY</a> | ||
</p> | ||
</div> | ||
{% endblock %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{% load humanize %} | ||
|
||
Get more applicant on your bounty! | ||
|
||
We noticed you dont have any contributors on your bounty | ||
Bounty Title : {{ bount.title }} | ||
Bounty Link : {{ bounty.absolute_url }} | ||
Bounty Amount : {{ bounty.value_true }} {{ bounty.token_name }} | ||
Bounty Amount (USD) : {{ bounty.value_in_usdt_now }} USD | ||
|
||
Go to the Users Directory {{ directory_link }} to discover and invite the best contributors | ||
for your bounty! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if this should be transactional.