From 7c204ef290393955db3fccd8f8632ddc6f1ee625 Mon Sep 17 00:00:00 2001 From: Mark Beacom Date: Wed, 25 Apr 2018 17:15:00 -0400 Subject: [PATCH 01/11] Modify setup_lang to use User (#980) * Fix #979 - Modify setup_lang to use User * Add tests, use get, and handle multi and none cases --- app/dashboard/models.py | 4 +-- app/marketing/mails.py | 22 +++++++++--- app/marketing/tests/test_mails.py | 57 +++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 7 deletions(-) create mode 100644 app/marketing/tests/test_mails.py diff --git a/app/dashboard/models.py b/app/dashboard/models.py index 479f4633ee1..70c6c9cbc5f 100644 --- a/app/dashboard/models.py +++ b/app/dashboard/models.py @@ -1062,7 +1062,7 @@ def get_access_token(self, save=True): return access_token def get_profile_preferred_language(self): - return settings.LANGUAGE_CODE if self.pref_lang_code is None else self.pref_lang_code + return settings.LANGUAGE_CODE if not self.pref_lang_code else self.pref_lang_code @receiver(user_logged_in) def post_login(sender, request, user, **kwargs): @@ -1268,7 +1268,7 @@ class ToolVote(models.Model): value = models.IntegerField(default=0) @property - def tool(self): + def tool(self): try: return Tool.objects.filter(votes__in=[self.pk]).first() except: diff --git a/app/marketing/mails.py b/app/marketing/mails.py index 5e3d5e6063b..d3ef4f25e15 100644 --- a/app/marketing/mails.py +++ b/app/marketing/mails.py @@ -389,10 +389,22 @@ def bounty_uninterested(to_email, bounty, interest): def setup_lang(to_email): + """Activate the User's language preferences based on their email address. + + Args: + to_email (str): The email address to lookup language preferences for. + + """ + from django.contrib.auth.models import User + user = None + try: - from dashboard.models import Profile - profile = Profile.objects.filter(email=to_email).first() - preferred_language = profile.get_profile_preferred_language() - translation.activate(preferred_language) - except Profile.DoesNotExist: + user = User.objects.select_related('profile').get(email=to_email) + except User.MultipleObjectsReturned: + user = User.objects.select_related('profile').filter(email=to_email).first() + except User.DoesNotExist: print("Could not determine recipient preferred email, using default.") + + if user and hasattr(user, 'profile'): + preferred_language = user.profile.get_profile_preferred_language() + translation.activate(preferred_language) diff --git a/app/marketing/tests/test_mails.py b/app/marketing/tests/test_mails.py new file mode 100644 index 00000000000..2dce3a20f5f --- /dev/null +++ b/app/marketing/tests/test_mails.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +"""Handle marketing mail related tests. + +Copyright (C) 2018 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 . + +""" +from unittest.mock import patch + +from django.utils import timezone + +from dashboard.models import Profile +from marketing.mails import setup_lang +from test_plus.test import TestCase + + +class MarketingMailsTest(TestCase): + """Define tests for marketing mails.""" + + def setUp(self): + """Perform setup for the testcase.""" + self.email = 'user1@gitcoin.co' + self.user = self.make_user('user1') + self.user.email = self.email + self.user.profile = Profile.objects.create( + user=self.user, + handle='user1', + last_sync_date=timezone.now(), + data={}, + repos_data={} + ) + self.user.save() + + @patch('django.utils.translation.activate') + def test_setup_lang(self, mock_translation_activate): + """Test the marketing mails setup_lang method.""" + setup_lang(self.email) + assert mock_translation_activate.call_count == 1 + mock_translation_activate.assert_called_once_with('en-us') + + @patch('django.utils.translation.activate') + def test_setup_lang_no_user(self, mock_translation_activate): + """Test the marketing mails setup_lang method.""" + setup_lang('bademail@gitcoin.co') + assert mock_translation_activate.call_count == 0 From 33c6abe72287244bda2d939f1497896c9798256a Mon Sep 17 00:00:00 2001 From: Owocki Date: Wed, 25 Apr 2018 17:29:52 -0600 Subject: [PATCH 02/11] cleans up the email suppression functionality --- app/marketing/mails.py | 42 +++++++++++++++++++++++++----------------- app/marketing/utils.py | 12 ++++++++++-- 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/app/marketing/mails.py b/app/marketing/mails.py index 5e3d5e6063b..565f5d2aafa 100644 --- a/app/marketing/mails.py +++ b/app/marketing/mails.py @@ -101,7 +101,8 @@ def bounty_feedback(bounty, persona='fulfiller', previous_bounties=[]): subject = bounty.github_url html, text = render_bounty_feedback(bounty, persona, previous_bounties) cc_emails = [from_email, 'team@gitcoin.co'] - send_mail(from_email, to_email, subject, text, cc_emails=cc_emails, from_name="Kevin Owocki (Gitcoin.co)") + if not should_suppress_notification_email(to_email, 'transactional'): + send_mail(from_email, to_email, subject, text, cc_emails=cc_emails, from_name="Kevin Owocki (Gitcoin.co)") finally: translation.activate(cur_language) @@ -123,7 +124,8 @@ def tip_email(tip, to_emails, is_new): from_email = settings.CONTACT_EMAIL html, text = render_tip_email(to_email, tip, is_new) - send_mail(from_email, to_email, subject, text, html) + if not should_suppress_notification_email(to_email, 'urgent'): + send_mail(from_email, to_email, subject, text, html) finally: translation.activate(cur_language) @@ -137,7 +139,8 @@ def new_faucet_request(fr): subject = _("New Faucet Request") body_str = _("A new faucet request was completed. You may fund the request here") body = f"{body_str}: https://gitcoin.co/_administration/process_faucet_request/{fr.pk}" - send_mail(from_email, to_email, subject, body, from_name=_("No Reply from Gitcoin.co")) + if not should_suppress_notification_email(to_email, 'admin'): + send_mail(from_email, to_email, subject, body, from_name=_("No Reply from Gitcoin.co")) finally: translation.activate(cur_language) @@ -147,7 +150,8 @@ def new_feedback(email, feedback): from_email = settings.SERVER_EMAIL subject = "New Feedback" body = f"New feedback from {email}: {feedback}" - send_mail(from_email, to_email, subject, body, from_name="No Reply from Gitcoin.co") + if not should_suppress_notification_email(to_email, 'admin'): + send_mail(from_email, to_email, subject, body, from_name="No Reply from Gitcoin.co") def new_external_bounty(): @@ -159,7 +163,8 @@ def new_external_bounty(): setup_lang(to_email) subject = _("New External Bounty") body = f"https://gitcoin.co/_administrationexternal_bounties/externalbounty" - send_mail(from_email, to_email, subject, body, from_name=_("No Reply from Gitcoin.co")) + if not should_suppress_notification_email(to_email, 'admin'): + send_mail(from_email, to_email, subject, body, from_name=_("No Reply from Gitcoin.co")) finally: translation.activate(cur_language) @@ -173,7 +178,8 @@ def processed_faucet_request(fr): setup_lang(to_email) html, text = render_faucet_request(fr) - send_mail(from_email, to_email, subject, text, html) + if not should_suppress_notification_email(to_email, 'urgent'): + send_mail(from_email, to_email, subject, text, html) finally: translation.activate(cur_language) @@ -186,7 +192,8 @@ def reject_faucet_request(fr): try: setup_lang(to_email) html, text = render_faucet_rejected(fr) - send_mail(from_email, to_email, subject, text, html) + if not should_suppress_notification_email(to_email, 'urgent'): + send_mail(from_email, to_email, subject, text, html) finally: translation.activate(cur_language) @@ -211,7 +218,7 @@ def new_bounty(bounties, to_emails=None): from_email = settings.CONTACT_EMAIL html, text = render_new_bounty(to_email, bounties) - if not should_suppress_notification_email(to_email): + if not should_suppress_notification_email(to_email, 'transactional'): send_mail(from_email, to_email, subject, text, html) finally: translation.activate(cur_language) @@ -228,7 +235,7 @@ def weekly_roundup(to_emails=None): html, text, subject = render_new_bounty_roundup(to_email) from_email = settings.PERSONAL_CONTACT_EMAIL - if not should_suppress_notification_email(to_email): + if not should_suppress_notification_email(to_email, 'roundup'): send_mail(from_email, to_email, subject, text, html, from_name="Kevin Owocki (Gitcoin.co)") finally: translation.activate(cur_language) @@ -250,7 +257,7 @@ def new_work_submission(bounty, to_emails=None): from_email = settings.CONTACT_EMAIL html, text = render_new_work_submission(to_email, bounty) - if not should_suppress_notification_email(to_email): + if not should_suppress_notification_email(to_email, 'transactional'): send_mail(from_email, to_email, subject, text, html) finally: translation.activate(cur_language) @@ -272,7 +279,7 @@ def new_bounty_rejection(bounty, to_emails=None): from_email = settings.CONTACT_EMAIL html, text = render_new_bounty_rejection(to_email, bounty) - if not should_suppress_notification_email(to_email): + if not should_suppress_notification_email(to_email, 'transactional'): send_mail(from_email, to_email, subject, text, html) finally: translation.activate(cur_language) @@ -294,7 +301,7 @@ def new_bounty_acceptance(bounty, to_emails=None): from_email = settings.CONTACT_EMAIL html, text = render_new_bounty_acceptance(to_email, bounty) - if not should_suppress_notification_email(to_email): + if not should_suppress_notification_email(to_email, 'transactional'): send_mail(from_email, to_email, subject, text, html) finally: translation.activate(cur_language) @@ -310,7 +317,8 @@ def new_match(to_emails, bounty, github_username): setup_lang(to_email) from_email = settings.CONTACT_EMAIL html, text = render_match_email(bounty, github_username) - send_mail(from_email, to_email, subject, text, html, cc_emails=to_emails) + if not should_suppress_notification_email(to_email, 'transactional'): + send_mail(from_email, to_email, subject, text, html, cc_emails=to_emails) finally: translation.activate(cur_language) @@ -338,7 +346,7 @@ def bounty_expire_warning(bounty, to_emails=None): from_email = settings.CONTACT_EMAIL html, text = render_bounty_expire_warning(to_email, bounty) - if not should_suppress_notification_email(to_email): + if not should_suppress_notification_email(to_email, 'transactional'): send_mail(from_email, to_email, subject, text, html) finally: translation.activate(cur_language) @@ -354,7 +362,7 @@ def bounty_startwork_expire_warning(to_email, bounty, interest, time_delta_days) html, text = render_bounty_startwork_expire_warning(to_email, bounty, interest, time_delta_days) subject = gettext("Are you still working on '{}' ? ").format(bounty.title_or_desc) - if not should_suppress_notification_email(to_email): + if not should_suppress_notification_email(to_email, 'transactional'): send_mail(from_email, to_email, subject, text, html) finally: translation.activate(cur_language) @@ -369,7 +377,7 @@ def bounty_startwork_expired(to_email, bounty, interest, time_delta_days): html, text = render_bounty_startwork_expire_warning(to_email, bounty, interest, time_delta_days) subject = gettext("We've removed you from the task: '{}' ? ").format(bounty.title_or_desc) - if not should_suppress_notification_email(to_email): + if not should_suppress_notification_email(to_email, 'transactional'): send_mail(from_email, to_email, subject, text, html) finally: translation.activate(cur_language) @@ -382,7 +390,7 @@ def bounty_uninterested(to_email, bounty, interest): html, text = render_bounty_unintersted(to_email, bounty, interest) subject = "Funder has removed you from the task: '{}' ? ".format(bounty.title_or_desc) - if not should_suppress_notification_email(to_email): + if not should_suppress_notification_email(to_email, 'transactional'): send_mail(from_email, to_email, subject, text, html) finally: translation.activate(cur_language) diff --git a/app/marketing/utils.py b/app/marketing/utils.py index b73ee483b72..fd102d1443e 100644 --- a/app/marketing/utils.py +++ b/app/marketing/utils.py @@ -34,10 +34,18 @@ def invite_to_slack(email): return response -def should_suppress_notification_email(email): +def should_suppress_notification_email(email, _type='transactional'): queryset = EmailSubscriber.objects.filter(email__iexact=email) if queryset.exists(): - return queryset.first().preferences.get('level', '') in ['nothing', 'lite1'] + level = queryset.first().preferences.get('level', '') + if _type in ['urgent', 'admin']: + return False # these email types are always sent + if level == 'nothing': + return True + if level == 'lite1' and _type == 'transactional': + return True + if level == 'lite' and _type == 'roundup': + return True return False From 4bcf0def91ff4dcac6727d31a84f5291e04c1150 Mon Sep 17 00:00:00 2001 From: Kevin Owocki Date: Thu, 26 Apr 2018 08:08:15 -0600 Subject: [PATCH 03/11] unsupported network warnings when trying to do an aciton on a network we dont support (#978) * unsupported network warnings when trying to do an aciton on a network we dont support * feedback * linting --- app/assets/v2/js/pages/fulfill_bounty.js | 7 +++++++ app/assets/v2/js/pages/increase_bounty.js | 7 +++++++ app/assets/v2/js/pages/kill_bounty.js | 7 +++++++ app/assets/v2/js/pages/new_bounty.js | 7 +++++++ app/assets/v2/js/pages/process_bounty.js | 7 +++++++ 5 files changed, 35 insertions(+) diff --git a/app/assets/v2/js/pages/fulfill_bounty.js b/app/assets/v2/js/pages/fulfill_bounty.js index 1a82894f307..c10e687fb2f 100644 --- a/app/assets/v2/js/pages/fulfill_bounty.js +++ b/app/assets/v2/js/pages/fulfill_bounty.js @@ -24,6 +24,13 @@ window.onload = function() { $('#submitBounty').validate({ submitHandler: function(form) { + try { + bounty_address(); + } catch (exception) { + _alert(gettext('You are on an unsupported network. Please change your network to a supported network.')); + return; + } + var data = {}; var disabled = $(form) .find(':input:disabled') diff --git a/app/assets/v2/js/pages/increase_bounty.js b/app/assets/v2/js/pages/increase_bounty.js index 82625e57ffe..bef726042de 100644 --- a/app/assets/v2/js/pages/increase_bounty.js +++ b/app/assets/v2/js/pages/increase_bounty.js @@ -19,6 +19,13 @@ $(document).ready(function() { // submit bounty button click $('#submitBounty').click(function(e) { + try { + bounty_address(); + } catch (exception) { + _alert(gettext('You are on an unsupported network. Please change your network to a supported network.')); + return; + } + mixpanel.track('Increase Bounty Clicked (funder)', {}); // setup diff --git a/app/assets/v2/js/pages/kill_bounty.js b/app/assets/v2/js/pages/kill_bounty.js index 052e628c6de..3cdd88d8245 100644 --- a/app/assets/v2/js/pages/kill_bounty.js +++ b/app/assets/v2/js/pages/kill_bounty.js @@ -16,6 +16,13 @@ window.onload = function() { $('#submitBounty').validate({ submitHandler: function(form) { + try { + bounty_address(); + } catch (exception) { + _alert(gettext('You are on an unsupported network. Please change your network to a supported network.')); + return; + } + var data = {}; var disabled = $(form) .find(':input:disabled') diff --git a/app/assets/v2/js/pages/new_bounty.js b/app/assets/v2/js/pages/new_bounty.js index 8aa3c61b2ad..2cdf60258b8 100644 --- a/app/assets/v2/js/pages/new_bounty.js +++ b/app/assets/v2/js/pages/new_bounty.js @@ -73,6 +73,13 @@ $(document).ready(function() { $('#submitBounty').validate({ submitHandler: function(form) { + try { + bounty_address(); + } catch (exception) { + _alert(gettext('You are on an unsupported network. Please change your network to a supported network.')); + return; + } + var data = {}; var disabled = $(form) .find(':input:disabled') diff --git a/app/assets/v2/js/pages/process_bounty.js b/app/assets/v2/js/pages/process_bounty.js index 65d4dfc47d6..7ffac7de91b 100644 --- a/app/assets/v2/js/pages/process_bounty.js +++ b/app/assets/v2/js/pages/process_bounty.js @@ -64,6 +64,13 @@ window.onload = function() { }); $('#acceptBounty').click(function(e) { + try { + bounty_address(); + } catch (exception) { + _alert(gettext('You are on an unsupported network. Please change your network to a supported network.')); + return; + } + mixpanel.track('Process Bounty Clicked', {}); e.preventDefault(); var whatAction = $(this).html().trim(); From 38aa0f65d2a5cee3c3ecb24b7eb5ac203ad8417a Mon Sep 17 00:00:00 2001 From: Mark Beacom Date: Thu, 26 Apr 2018 11:11:21 -0400 Subject: [PATCH 04/11] Fix #988 - Update email settings URL to conform to the other setting urls --- app/app/urls.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/app/urls.py b/app/app/urls.py index 4129e71fd88..6fed6e05ef7 100644 --- a/app/app/urls.py +++ b/app/app/urls.py @@ -184,12 +184,11 @@ url(r'^_administration/process_faucet_request/(.*)$', faucet.views.process_faucet_request, name='process_faucet_request'), # settings - url(r'^email/settings/(.*)', marketing.views.email_settings, name='email_settings'), - url(r'^settings/email/(.*)', marketing.views.email_settings, name='settings_email'), - url(r'^settings/privacy/?', marketing.views.privacy_settings, name='privacy_settings'), - url(r'^settings/matching/?', marketing.views.matching_settings, name='matching_settings'), - url(r'^settings/feedback/?', marketing.views.feedback_settings, name='feedback_settings'), - url(r'^settings/(.*)?', marketing.views.email_settings, name='feedback_settings'), + re_path(r'^settings/email/(.*)', marketing.views.email_settings, name='email_settings'), + re_path(r'^settings/privacy/?', marketing.views.privacy_settings, name='privacy_settings'), + re_path(r'^settings/matching/?', marketing.views.matching_settings, name='matching_settings'), + re_path(r'^settings/feedback/?', marketing.views.feedback_settings, name='feedback_settings'), + re_path(r'^settings/(.*)?', marketing.views.email_settings, name='feedback_settings'), # marketing views url(r'^leaderboard/(.*)', marketing.views.leaderboard, name='leaderboard'), From cc70aeb40d4d58f7137f0e4f3f1f599445d1cc3c Mon Sep 17 00:00:00 2001 From: Mark Beacom Date: Thu, 26 Apr 2018 13:06:04 -0400 Subject: [PATCH 05/11] Fix #991 - Fix rendering of 2nd warning via gitcoinbot --- app/dashboard/notifications.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/dashboard/notifications.py b/app/dashboard/notifications.py index 6477e8342f3..5df1497c3d4 100644 --- a/app/dashboard/notifications.py +++ b/app/dashboard/notifications.py @@ -263,7 +263,7 @@ def get_status_header(bounty): else: statuses.append('**Done**') - + #1. Open | **2. Started** | 3. Submitted | 4. Done status_bar = "" for x, status in enumerate(statuses): @@ -699,7 +699,7 @@ def maybe_warn_user_removed_github(bounty, username, last_heard_from_user_days): return False first_warning = 'x' - second_warning = 'x' if last_heard_from_user_days > num_days_back_to_warn else '' + second_warning = 'x' if last_heard_from_user_days > num_days_back_to_warn else ' ' msg = f"""@{username} are you still working on this issue? * [{first_warning}] warning 1 ({num_days_back_to_warn} days) * [{second_warning}] warning 2 ({num_days_back_to_warn * 2} days) From f133648a0787c825ca4ffa64a2e07b7a60b88299 Mon Sep 17 00:00:00 2001 From: Kevin Owocki Date: Thu, 26 Apr 2018 11:26:48 -0600 Subject: [PATCH 06/11] pricing brackets (#972) * pricing brackets * small cleanup * Fix eslint --- app/assets/v2/css/forms/input.css | 9 +++--- app/assets/v2/js/amounts.js | 33 ++++++++++++++++++-- app/assets/v2/js/pages/new_bounty.js | 1 + app/dashboard/templates/increase_bounty.html | 2 +- app/dashboard/templates/submit_bounty.html | 4 +-- 5 files changed, 40 insertions(+), 9 deletions(-) diff --git a/app/assets/v2/css/forms/input.css b/app/assets/v2/css/forms/input.css index 7ce25d87636..8d0491f03d2 100644 --- a/app/assets/v2/css/forms/input.css +++ b/app/assets/v2/css/forms/input.css @@ -62,9 +62,10 @@ font-size: 12px; font-family: 'Muli', sans-serif; } - .form__input-help--dynamic { - position: absolute; - bottom: -20px; - left: 0; + margin-top: 5px; + display: block; } +.amount_container{ + height: 100px; +} \ No newline at end of file diff --git a/app/assets/v2/js/amounts.js b/app/assets/v2/js/amounts.js index 9b25ec0ab44..e7a18dccfbc 100644 --- a/app/assets/v2/js/amounts.js +++ b/app/assets/v2/js/amounts.js @@ -13,6 +13,25 @@ var estimate = function(amount, conv_rate) { return gettext('Approx: Unknown amount'); }; +var get_rates_estimate = function(usd_amount) { + if (!usd_amount) { + return ''; + } + var rates_addon = []; + var rates = [ 40, 80, 120 ]; + + for (var i = 0; i < rates.length; i++) { + var rate = rates[i]; + var hours = usd_amount / rate; + var round_decimals = hours < 1 ? 2 : 1; + + hours = Math.round(hours, round_decimals); + rates_addon.push('' + hours + ' hrs at $' + rate + '/hr'); + } + rates_addon = rates_addon.join(', '); + return rates_addon; +}; + var getUSDEstimate = function(amount, denomination, callback) { var conv_rate; var eth_usd; @@ -25,7 +44,12 @@ var getUSDEstimate = function(amount, denomination, callback) { } if (document.conversion_rates && document.conversion_rates[denomination]) { conv_rate = document.conversion_rates[denomination]; - return callback(estimate(amount, conv_rate)); + var usd_estimate = estimate(amount, conv_rate); + + rate_estimate = get_rates_estimate(amount * conv_rate); + var return_text = usd_estimate + '
' + rate_estimate; + + return callback(return_text); } var request_url = '/sync/get_amount?amount=' + amount + '&denomination=' + denomination; @@ -38,7 +62,12 @@ var getUSDEstimate = function(amount, denomination, callback) { document.conversion_rates = {}; } document.conversion_rates[denomination] = conv_rate; - return callback(estimate(amount, conv_rate)); + var usd_estimate = estimate(amount, conv_rate); + + rate_estimate = get_rates_estimate(amount * conv_rate); + var return_text = usd_estimate + '
' + rate_estimate; + + return callback(return_text); }).fail(function() { return callback(new Error(gettext('Approx: Unknown amount'))); }); diff --git a/app/assets/v2/js/pages/new_bounty.js b/app/assets/v2/js/pages/new_bounty.js index 2cdf60258b8..627984939e0 100644 --- a/app/assets/v2/js/pages/new_bounty.js +++ b/app/assets/v2/js/pages/new_bounty.js @@ -47,6 +47,7 @@ $(document).ready(function() { $('input[name=amount]').blur(setUsdAmount); $('select[name=deonomination]').change(setUsdAmount); $('input[name=issueURL]').blur(retrieveIssueDetails); + setTimeout(setUsdAmount, 1000); if ($('input[name=issueURL]').val() != '') { retrieveIssueDetails(); diff --git a/app/dashboard/templates/increase_bounty.html b/app/dashboard/templates/increase_bounty.html index f555ad9a876..e0ee89a94fc 100644 --- a/app/dashboard/templates/increase_bounty.html +++ b/app/dashboard/templates/increase_bounty.html @@ -63,9 +63,9 @@

Increase Funding

- +
diff --git a/app/dashboard/templates/submit_bounty.html b/app/dashboard/templates/submit_bounty.html index b1a0ccb4ec0..9c6fc8cb1c5 100644 --- a/app/dashboard/templates/submit_bounty.html +++ b/app/dashboard/templates/submit_bounty.html @@ -50,7 +50,7 @@

{% trans "Fund an Issue" %}

-
+
@@ -60,9 +60,9 @@

{% trans "Fund an Issue" %}

-
+
{% include 'shared/github_username.html' %} {% include 'shared/notification_email.html' %} From bd59f86ded4382b29a2d7ed336a66b4021628a5f Mon Sep 17 00:00:00 2001 From: Owocki Date: Thu, 26 Apr 2018 11:28:09 -0600 Subject: [PATCH 07/11] wrong positional arguments --- app/marketing/management/commands/expiration_start_work.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/marketing/management/commands/expiration_start_work.py b/app/marketing/management/commands/expiration_start_work.py index c0d3162c7a8..fc11af19fc6 100644 --- a/app/marketing/management/commands/expiration_start_work.py +++ b/app/marketing/management/commands/expiration_start_work.py @@ -107,7 +107,7 @@ def handle(self, *args, **options): interest.delete() # commenting on the GH issue - maybe_notify_user_removed_github(bounty, interest.profile.handle, last_heard_from_user_days, last_heard_from_user_days) + maybe_notify_user_removed_github(bounty, interest.profile.handle, last_heard_from_user_days) # commenting in slack maybe_notify_bounty_user_removed_to_slack(bounty, interest.profile.handle) # send email From c941eab6694a84cac77df75d3c440a4515c68aac Mon Sep 17 00:00:00 2001 From: Owocki Date: Thu, 26 Apr 2018 12:03:11 -0600 Subject: [PATCH 08/11] startwork fixes --- app/marketing/management/commands/expiration_start_work.py | 1 + 1 file changed, 1 insertion(+) diff --git a/app/marketing/management/commands/expiration_start_work.py b/app/marketing/management/commands/expiration_start_work.py index fc11af19fc6..e8eb9dd9180 100644 --- a/app/marketing/management/commands/expiration_start_work.py +++ b/app/marketing/management/commands/expiration_start_work.py @@ -52,6 +52,7 @@ def handle(self, *args, **options): num_days_back_to_delete_interest = 10 days = [i * 3 for i in range(1, 15)] + days.reverse() if settings.DEBUG: days = range(1, 1000) for day in days: From 7c1ad33f5884eb282d54ebcd072b8ecfecadb9ec Mon Sep 17 00:00:00 2001 From: Owocki Date: Thu, 26 Apr 2018 12:06:52 -0600 Subject: [PATCH 09/11] notifications was wrong --- app/dashboard/notifications.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/dashboard/notifications.py b/app/dashboard/notifications.py index 5df1497c3d4..e595c7b81a9 100644 --- a/app/dashboard/notifications.py +++ b/app/dashboard/notifications.py @@ -703,7 +703,7 @@ def maybe_warn_user_removed_github(bounty, username, last_heard_from_user_days): msg = f"""@{username} are you still working on this issue? * [{first_warning}] warning 1 ({num_days_back_to_warn} days) * [{second_warning}] warning 2 ({num_days_back_to_warn * 2} days) -* [x] auto removal ({num_days_back_to_delete_interest} days) +* [ ] auto removal ({num_days_back_to_delete_interest} days) """ post_issue_comment(bounty.org_name, bounty.github_repo_name, bounty.github_issue_number, msg) From c9ba80abc5e0670ec86af98adec01b531577347b Mon Sep 17 00:00:00 2001 From: Owocki Date: Thu, 26 Apr 2018 16:43:47 -0600 Subject: [PATCH 10/11] https://github.com/gitcoinco/web/issues/987 --- app/app/tests/test_app_urls.py | 4 ++-- app/dashboard/tests/test_notifications.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/app/tests/test_app_urls.py b/app/app/tests/test_app_urls.py index 449c38a9be9..ba5ac8ed7b6 100644 --- a/app/app/tests/test_app_urls.py +++ b/app/app/tests/test_app_urls.py @@ -50,11 +50,11 @@ def test_sitemap_resolve(self): def test_email_settings_reverse(self): """Test the email_settings url and check the reverse.""" priv_key = token_hex(16)[:29] - self.assertEqual(reverse('email_settings', args=(priv_key, )), f'/email/settings/{priv_key}') + self.assertEqual(reverse('email_settings', args=(priv_key, )), f'/settings/email/{priv_key}') def test_email_settings_resolve(self): """Test the email_settings url and check the resolution.""" - self.assertEqual(resolve('/email/settings/').view_name, 'email_settings') + self.assertEqual(resolve('/settings/email/').view_name, 'email_settings') def test_leaderboard_reverse(self): """Test the leaderboard url and check the reverse.""" diff --git a/app/dashboard/tests/test_notifications.py b/app/dashboard/tests/test_notifications.py index d7c5798a6b5..858986cf004 100644 --- a/app/dashboard/tests/test_notifications.py +++ b/app/dashboard/tests/test_notifications.py @@ -57,7 +57,7 @@ def setUp(self): def test_build_github_notification_new_bounty(self): """Test the dashboard helper build_github_notification method with new_bounty.""" message = build_github_notification(self.bounty, 'new_bounty') - assert message.startswith(f'__This issue now has a funding of {self.natural_value} {self.bounty.token_name}') + assert f'__This issue now has a funding of {self.natural_value} {self.bounty.token_name}' in message assert self.usdt_value in message assert f'[here]({self.absolute_url})' in message assert f'${self.amount_open_work}' in message @@ -65,14 +65,14 @@ def test_build_github_notification_new_bounty(self): def test_build_github_notification_killed_bounty(self): """Test the dashboard helper build_github_notification method with killed_bounty.""" message = build_github_notification(self.bounty, 'killed_bounty') - assert message.startswith(f"__The funding of {self.natural_value} {self.bounty.token_name} {self.usdt_value}") + assert f"__The funding of {self.natural_value} {self.bounty.token_name} {self.usdt_value}" in message assert 'Questions?' in message assert f'${self.amount_open_work}' in message def test_build_github_notification_increased_bounty(self): """Test the dashboard helper build_github_notification method with new_bounty.""" message = build_github_notification(self.bounty, 'increased_bounty') - assert message.startswith(f'__The funding of this issue was increased to {self.natural_value} {self.bounty.token_name}') + assert f'__The funding of this issue was increased to {self.natural_value} {self.bounty.token_name}' in message assert self.usdt_value in message assert f'[here]({self.absolute_url})' in message assert f'${self.amount_open_work}' in message From 2102eb81bf6106c05b5fc0ea3e709be3c87c61c9 Mon Sep 17 00:00:00 2001 From: Owocki Date: Thu, 26 Apr 2018 16:46:11 -0600 Subject: [PATCH 11/11] fixes https://github.com/gitcoinco/web/issues/987 --- app/dashboard/tests/test_notifications.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/dashboard/tests/test_notifications.py b/app/dashboard/tests/test_notifications.py index 858986cf004..1a9d3656f40 100644 --- a/app/dashboard/tests/test_notifications.py +++ b/app/dashboard/tests/test_notifications.py @@ -74,7 +74,7 @@ def test_build_github_notification_increased_bounty(self): message = build_github_notification(self.bounty, 'increased_bounty') assert f'__The funding of this issue was increased to {self.natural_value} {self.bounty.token_name}' in message assert self.usdt_value in message - assert f'[here]({self.absolute_url})' in message + assert f'This issue now has a funding of' in message assert f'${self.amount_open_work}' in message def tearDown(self):