- {% if tab == 'explorer' %}
- {% include 'dashboard/tab_explorer.html' %}
- {% elif tab == 'resume' %}
- {% include 'profiles/tab_.html' %}
- {% endif %}
-
-
-
-
-
diff --git a/app/dashboard/templates/notifyfunder.html b/app/dashboard/templates/notifyfunder.html
deleted file mode 100644
index 31a470d7182..00000000000
--- a/app/dashboard/templates/notifyfunder.html
+++ /dev/null
@@ -1,45 +0,0 @@
-{% comment %}
- Copyright (C) 2021 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 .
-{% endcomment %}
-{% load i18n static %}
-
-
-
-
-
-
-
{% trans "Send Payment Reminder" %}
-
-
-
- {% trans "This button sends a notification to the funder to pay out the bounty. Are you sure the bounty has been completed?" %}
-
-
-
-
-
-
-
diff --git a/app/dashboard/templates/profiles/none.html b/app/dashboard/templates/profiles/none.html
deleted file mode 100644
index 987958b9d1d..00000000000
--- a/app/dashboard/templates/profiles/none.html
+++ /dev/null
@@ -1,67 +0,0 @@
-{% comment %}
- Copyright (C) 2021 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 .
-{% endcomment %}
-{% load i18n static %}
-
-
-
-
-
-
{% trans 'Oops! Looks like this user has not participated in any bounty yet.' %}
-
{% trans 'In the meantime, here are some things you can do:' %}
-
-
-
-
-
-
-
-
- {% trans 'Start working on exciting bounties with the Issue Explorer' %}
-
diff --git a/app/dashboard/templates/shared/bounty_nav.html b/app/dashboard/templates/shared/bounty_nav.html
deleted file mode 100644
index 1b38a01e69d..00000000000
--- a/app/dashboard/templates/shared/bounty_nav.html
+++ /dev/null
@@ -1,53 +0,0 @@
-{% comment %}
- Copyright (C) 2021 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 .
-{% endcomment %}
-{% load i18n %}
-
-
-
- 1.
- {% if past_tense %}
- {% trans "Open" %}
- {% else %}
- {% trans "Create Work" %}
- {% endif %}
-
-
- 2.
- {% if past_tense %}
- {% trans "Work Started" %}
- {% else %}
- {% trans "Start Work" %}
- {% endif %}
-
-
- 3.
- {% if past_tense %}
- {% trans "Work Submitted" %}
- {% else %}
- {% trans "Submit Work" %}
- {% endif %}
-
-
- 4.
- {% if past_tense %}
- {% trans "Work Done" %}
- {% else %}
- {% trans "Accept Work" %}
- {% endif %}
-
-
-
diff --git a/app/dashboard/templates/shared/github_username.html b/app/dashboard/templates/shared/github_username.html
deleted file mode 100644
index 2212853d64a..00000000000
--- a/app/dashboard/templates/shared/github_username.html
+++ /dev/null
@@ -1,24 +0,0 @@
-{% comment %}
- Copyright (C) 2021 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 .
-{% endcomment %}
-{% load i18n %}
-
diff --git a/app/dashboard/templates/shared/issue_deadline.html b/app/dashboard/templates/shared/issue_deadline.html
deleted file mode 100644
index 56d189b768a..00000000000
--- a/app/dashboard/templates/shared/issue_deadline.html
+++ /dev/null
@@ -1,27 +0,0 @@
-{% comment %}
- Copyright (C) 2021 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 .
-{% endcomment %}
-{% load i18n %}
-
-
-
-
-
-
-
-
-
diff --git a/app/dashboard/templates/shared/notification_email.html b/app/dashboard/templates/shared/notification_email.html
deleted file mode 100644
index 089cfe528d2..00000000000
--- a/app/dashboard/templates/shared/notification_email.html
+++ /dev/null
@@ -1,24 +0,0 @@
-{% comment %}
- Copyright (C) 2021 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 .
-{% endcomment %}
-{% load i18n %}
-
-
-
- {% if show_information_publicly_checkbox %}
- {% include "shared/show_information_publicly.html" with id="show_email_publicly" %}
- {% endif %}
-
diff --git a/app/dashboard/templates/shared/pricing.html b/app/dashboard/templates/shared/pricing.html
deleted file mode 100644
index 4de29a6181d..00000000000
--- a/app/dashboard/templates/shared/pricing.html
+++ /dev/null
@@ -1,50 +0,0 @@
-{% comment %}
- Copyright (C) 2021 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 .
-{% endcomment %}
-{% load i18n %}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- USD payment is powered by PayPal. Please note that there might be a small fee for payment to contributors in outside of the US.
-
-
-
diff --git a/app/dashboard/templates/shared/profile_rank_link.html b/app/dashboard/templates/shared/profile_rank_link.html
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/app/dashboard/templates/shared/send_tip_nav.html b/app/dashboard/templates/shared/send_tip_nav.html
deleted file mode 100644
index ea53afa7f41..00000000000
--- a/app/dashboard/templates/shared/send_tip_nav.html
+++ /dev/null
@@ -1,37 +0,0 @@
-{% comment %}
- Copyright (C) 2021 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 .
-{% endcomment %}
-{% load i18n %}
-
-
-
- 1.
- {% if past_tense %}
- {% trans "Sent" %}
- {% else %}
- {% trans "Send" %}
- {% endif %}
-
-
- 2.
- {% if past_tense %}
- {% trans "Fulfilled" %}
- {% else %}
- {% trans "Fulfill" %}
- {% endif %}
-
-
-
diff --git a/app/dashboard/templates/shared/sidebar_profile.html b/app/dashboard/templates/shared/sidebar_profile.html
deleted file mode 100644
index 3a107a63fea..00000000000
--- a/app/dashboard/templates/shared/sidebar_profile.html
+++ /dev/null
@@ -1,39 +0,0 @@
-{% comment %}
- Copyright (C) 2021 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 .
-{% endcomment %}
-{% load i18n %}
-
diff --git a/app/dashboard/tests/test_binance_sync.py b/app/dashboard/tests/test_binance_sync.py
index 98e39a68fe1..381d57b8b6c 100644
--- a/app/dashboard/tests/test_binance_sync.py
+++ b/app/dashboard/tests/test_binance_sync.py
@@ -17,14 +17,11 @@
along with this program. If not, see .
"""
-import os
from datetime import timedelta
-from unittest import mock
from django.utils import timezone
from dashboard.models import Bounty, BountyFulfillment, Profile
-from dashboard.sync.binance import get_binance_txn_status, sync_binance_payout
from test_plus.test import TestCase
@@ -67,7 +64,7 @@ def setUp(self):
)
BountyFulfillment.objects.create(
fulfiller_address='0x0000000000000000000000000000000000000000',
- bounty=bounty,
+ bounty=self.bounty,
payout_tx_id='0xc32f5ad8a1dec9e0ae67f0f55f772ea752e7e032b62b1cdaf8d392e12c66e919'
)
diff --git a/app/dashboard/tests/test_dashboard_helpers.py b/app/dashboard/tests/test_dashboard_helpers.py
index 52aad60973c..575630dea4e 100644
--- a/app/dashboard/tests/test_dashboard_helpers.py
+++ b/app/dashboard/tests/test_dashboard_helpers.py
@@ -17,19 +17,11 @@
along with this program. If not, see .
"""
-import json
-from datetime import date, datetime, timedelta
-from unittest.mock import patch
-
from django.conf import settings
from django.test.client import RequestFactory
-import pytz
-import requests_mock
-from dashboard.helpers import amount, is_lowball_bounty, issue_details, normalize_url, process_bounty_details
-from dashboard.models import Bounty
+from dashboard.helpers import amount, is_lowball_bounty, normalize_url
from economy.models import ConversionRate
-from marketing.mails import featured_funded_bounty
from test_plus.test import TestCase
diff --git a/app/dashboard/tests/test_dashboard_models.py b/app/dashboard/tests/test_dashboard_models.py
index 288c29bf587..2f6f5278453 100644
--- a/app/dashboard/tests/test_dashboard_models.py
+++ b/app/dashboard/tests/test_dashboard_models.py
@@ -209,20 +209,20 @@ def test_can_submit_standard_bounty_after_expiration_date_if_deadline_extended()
)
assert bounty.can_submit_after_expiration_date is True
- @staticmethod
- def test_title_or_desc():
- bounty = Bounty.objects.create(
- title='TitleTest',
- idx_status=0,
- is_open=False,
- web3_created=datetime(2008, 10, 31, tzinfo=pytz.UTC),
- expires_date=datetime(2008, 11, 30, tzinfo=pytz.UTC),
- github_url='https://github.com/gitcoinco/web/issues/0xDEADBEEF',
- raw_data={}
- )
- assert bounty.title_or_desc == "TitleTest"
- bounty.title = None
- assert bounty.title_or_desc == "https://github.com/gitcoinco/web/issues/0xDEADBEEF"
+ # @staticmethod
+ # def test_title_or_desc():
+ # bounty = Bounty.objects.create(
+ # title='TitleTest',
+ # idx_status=0,
+ # is_open=False,
+ # web3_created=datetime(2008, 10, 31, tzinfo=pytz.UTC),
+ # expires_date=datetime(2008, 11, 30, tzinfo=pytz.UTC),
+ # github_url='https://github.com/gitcoinco/web/issues/1',
+ # raw_data={}
+ # )
+ # assert bounty.title_or_desc == "TitleTest"
+ # bounty.title = None
+ # assert bounty.title_or_desc == "HTTP API Documentation"
@staticmethod
def test_github_issue_number():
diff --git a/app/dashboard/tests/test_dashboard_utils.py b/app/dashboard/tests/test_dashboard_utils.py
index eb92e1b936e..02b9692b6b1 100644
--- a/app/dashboard/tests/test_dashboard_utils.py
+++ b/app/dashboard/tests/test_dashboard_utils.py
@@ -24,13 +24,11 @@
from django.test.client import RequestFactory
from django.utils import timezone
-import ipfshttpclient
-import pytest
from dashboard.models import Bounty, Profile
from dashboard.utils import (
- IPFSCantConnectException, apply_new_bounty_deadline, clean_bounty_url, create_user_action, get_bounty, get_ipfs,
- get_ordinal_repr, get_token_recipient_senders, get_web3, getBountyContract, humanize_event_name, ipfs_cat_ipfsapi,
- re_market_bounty, release_bounty_to_the_public,
+ apply_new_bounty_deadline, clean_bounty_url, create_user_action, get_bounty, get_ordinal_repr,
+ get_token_recipient_senders, get_web3, getBountyContract, humanize_event_name, re_market_bounty,
+ release_bounty_to_the_public,
)
from eth_utils import is_address
from pytz import UTC
diff --git a/app/dashboard/utils.py b/app/dashboard/utils.py
index 3ebd0f8238d..03555265db3 100644
--- a/app/dashboard/utils.py
+++ b/app/dashboard/utils.py
@@ -21,7 +21,6 @@
import json
import logging
import re
-import time
from json.decoder import JSONDecodeError
from django.conf import settings
@@ -36,9 +35,7 @@
from compliance.models import Country, Entity
from cytoolz import compose
from dashboard.helpers import UnsupportedSchemaException, normalize_url, process_bounty_changes, process_bounty_details
-from dashboard.models import (
- Activity, BlockedUser, Bounty, BountyFulfillment, HackathonRegistration, Profile, UserAction,
-)
+from dashboard.models import Activity, BlockedUser, Bounty, Profile, UserAction
from dashboard.sync.algorand import sync_algorand_payout
from dashboard.sync.binance import sync_binance_payout
from dashboard.sync.btc import sync_btc_payout
@@ -54,7 +51,6 @@
from dashboard.sync.tezos import sync_tezos_payout
from dashboard.sync.xinfin import sync_xinfin_payout
from dashboard.sync.zil import sync_zil_payout
-from ens.auto import ns
from ens.utils import name_to_hash
from eth_abi import decode_single, encode_single
from eth_utils import keccak, to_checksum_address, to_hex
@@ -360,15 +356,6 @@ def get_graphql_result(uri, query):
return json.loads(result)
-def get_profile_from_referral_code(code):
- """Returns a profile from the unique code
-
- Returns:
- A unique string for each profile
- """
- return base64.urlsafe_b64decode(code.encode()).decode()
-
-
def get_bounty_invite_url(inviter, bounty_id):
"""Returns a unique url for each bounty and one who is inviting
Returns:
@@ -884,59 +871,10 @@ def clean_bounty_url(url):
return url
-def generate_pub_priv_keypair():
- # Thanks https://github.com/vkobel/ethereum-generate-wallet/blob/master/LICENSE.md
- import sha3
- from ecdsa import SECP256k1, SigningKey
-
- def checksum_encode(addr_str):
- keccak = sha3.keccak_256()
- out = ''
- addr = addr_str.lower().replace('0x', '')
- keccak.update(addr.encode('ascii'))
- hash_addr = keccak.hexdigest()
- for i, c in enumerate(addr):
- if int(hash_addr[i], 16) >= 8:
- out += c.upper()
- else:
- out += c
- return '0x' + out
-
- keccak = sha3.keccak_256()
-
- priv = SigningKey.generate(curve=SECP256k1)
- pub = priv.get_verifying_key().to_string()
-
- keccak.update(pub)
- address = keccak.hexdigest()[24:]
-
- def test(addrstr):
- assert(addrstr == checksum_encode(addrstr))
-
- test('0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed')
- test('0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359')
- test('0xdbF03B407c01E7cD3CBea99509d93f8DDDC8C6FB')
- test('0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb')
- test('0x7aA3a964CC5B0a76550F549FC30923e5c14EDA84')
-
- # print("Private key:", priv.to_string().hex())
- # print("Public key: ", pub.hex())
- # print("Address: ", checksum_encode(address))
- # return priv key, pub key, address
-
- return priv.to_string().hex(), pub.hex(), checksum_encode(address)
-
-
def get_bounty_semaphore_ns(standard_bounty_id):
return f'{SEMAPHORE_BOUNTY_NS}_{standard_bounty_id}_{SEMAPHORE_BOUNTY_SALT}'
-def release_bounty_lock(standard_bounty_id):
- from app.utils import release_semaphore
- ns = get_bounty_semaphore_ns(standard_bounty_id)
- release_semaphore(ns)
-
-
def profile_helper(handle, suppress_profile_hidden_exception=False, current_user=None, disable_cache=False, full_profile=False):
"""Define the profile helper.
diff --git a/app/dashboard/views.py b/app/dashboard/views.py
index 5b718b80e87..deec8404d41 100644
--- a/app/dashboard/views.py
+++ b/app/dashboard/views.py
@@ -18,10 +18,8 @@
'''
from __future__ import print_function, unicode_literals
-import asyncio
import base64
import calendar
-import getpass
import hashlib
import html
import json
@@ -41,8 +39,7 @@
from django.contrib.staticfiles.storage import staticfiles_storage
from django.core.exceptions import ObjectDoesNotExist, PermissionDenied, ValidationError
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
-from django.core.serializers.json import DjangoJSONEncoder
-from django.db.models import Avg, Count, Prefetch, Q, Sum
+from django.db.models import Count, Q, Sum
from django.http import Http404, HttpResponse, JsonResponse
from django.shortcuts import get_object_or_404, redirect
from django.template import loader
@@ -50,7 +47,6 @@
from django.templatetags.static import static
from django.urls import reverse
from django.utils import timezone
-from django.utils.html import escape, strip_tags
from django.utils.http import is_safe_url
from django.utils.text import slugify
from django.utils.timezone import localtime
@@ -59,7 +55,6 @@
from django.views.decorators.csrf import csrf_exempt, csrf_protect
from django.views.decorators.http import require_GET, require_POST
-import dateutil.parser
import ens
import magic
import pytz
@@ -67,9 +62,8 @@
import tweepy
from app.services import RedisService, TwilioService
from app.settings import (
- BMAS_ENDPOINT, EMAIL_ACCOUNT_VALIDATION, ES_CORE_ENDPOINT, ES_USER_ENDPOINT, PHONE_SALT, SMS_COOLDOWN_IN_MINUTES,
- SMS_MAX_VERIFICATION_ATTEMPTS, TWITTER_ACCESS_SECRET, TWITTER_ACCESS_TOKEN, TWITTER_CONSUMER_KEY,
- TWITTER_CONSUMER_SECRET,
+ EMAIL_ACCOUNT_VALIDATION, PHONE_SALT, SMS_COOLDOWN_IN_MINUTES, SMS_MAX_VERIFICATION_ATTEMPTS, TWITTER_ACCESS_SECRET,
+ TWITTER_ACCESS_TOKEN, TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET,
)
from app.utils import clean_str, ellipses, get_default_network
from avatar.models import AvatarTheme
@@ -80,28 +74,20 @@
from cacheops import invalidate_obj
from dashboard.brightid_utils import get_brightid_status
from dashboard.context import quickstart as qs
-from dashboard.duniter import CERTIFICATIONS_SCHEMA
from dashboard.idena_utils import (
IdenaNonce, get_handle_by_idena_token, idena_callback_url, next_validation_time, signature_address,
)
from dashboard.tasks import increment_view_count
from dashboard.utils import (
ProfileHiddenException, ProfileNotFoundException, build_profile_pairs, get_bounty_from_invite_url,
- get_ens_contract_addresss, get_ens_resolver_contract, get_orgs_perms, get_poap_earliest_owned_token_timestamp,
- profile_helper,
+ get_ens_contract_addresss, get_orgs_perms, get_poap_earliest_owned_token_timestamp, profile_helper,
)
from economy.utils import ConversionRateNotFoundError, convert_amount, convert_token_to_usdt
-from ens.auto import ns
-from ens.utils import name_to_hash
from eth_account.messages import defunct_hash_message
-from eth_utils import is_address, is_same_address, to_checksum_address, to_normalized_address
-from gas.utils import recommend_min_gas_price_to_confirm_in_time
-from git.utils import (
- get_auth_url, get_gh_issue_details, get_github_user_data, get_url_dict, is_github_token_valid, search_users,
-)
-from grants.models import Grant
+from eth_utils import is_address, is_same_address
+from git.utils import get_auth_url, get_issue_details, get_url_dict, get_user, is_github_token_valid, search_users
from grants.utils import get_clr_rounds_metadata
-from kudos.models import KudosTransfer, Token, Wallet
+from kudos.models import Token
from kudos.utils import humanize_name
# from mailchimp3 import MailChimp
from marketing.mails import admin_contact_funder, bounty_uninterested
@@ -110,7 +96,7 @@
new_reserved_issue, share_bounty, start_work_approved, start_work_new_applicant, start_work_rejected,
wall_post_email,
)
-from marketing.models import EmailSubscriber, Keyword, UpcomingDate
+from marketing.models import Keyword
from oauth2_provider.decorators import protected_resource
from oauthlib.oauth2.rfc6749.errors import InvalidGrantError
from perftools.models import JSONStore
@@ -119,11 +105,10 @@
from ratelimit.decorators import ratelimit
from requests_oauthlib import OAuth2Session
from requests_oauthlib.compliance_fixes import facebook_compliance_fix
-from rest_framework.renderers import JSONRenderer
from retail.helpers import get_ip
from retail.utils import programming_languages, programming_languages_full
from townsquare.models import Comment, PinnedPost
-from townsquare.views import get_following_tribes, get_tags
+from townsquare.views import get_tags
from unidecode import unidecode
from web3 import HTTPProvider, Web3
@@ -135,18 +120,16 @@
bounty_activity_event_adapter, get_bounty_data_for_activity, handle_bounty_views, load_files_in_directory,
)
from .models import (
- Activity, Answer, BlockedURLFilter, Bounty, BountyEvent, BountyFulfillment, BountyInvites, CoinRedemption,
- CoinRedemptionRequest, Coupon, Earning, FeedbackEntry, HackathonEvent, HackathonProject, HackathonRegistration,
- HackathonSponsor, HackathonWorkshop, Interest, LabsResearch, MediaFile, Option, Poll, PortfolioItem, Profile,
- ProfileSerializer, ProfileVerification, ProfileView, Question, SearchHistory, Sponsor, Subscription, Tool, ToolVote,
- TribeMember, UserAction, UserDirectory, UserVerificationModel,
+ Activity, Answer, BlockedURLFilter, Bounty, BountyEvent, BountyFulfillment, BountyInvites, Coupon, Earning,
+ FeedbackEntry, HackathonEvent, HackathonProject, HackathonRegistration, HackathonSponsor, Interest, LabsResearch,
+ MediaFile, Option, Poll, PortfolioItem, Profile, ProfileSerializer, ProfileVerification, ProfileView, Question,
+ SearchHistory, Sponsor, Tool, TribeMember, UserAction, UserVerificationModel,
)
from .notifications import (
- maybe_market_tip_to_email, maybe_market_tip_to_github, maybe_market_tip_to_slack, maybe_market_to_email,
- maybe_market_to_github, maybe_market_to_slack, maybe_market_to_user_slack,
+ maybe_market_to_email, maybe_market_to_github, maybe_market_to_slack, maybe_market_to_user_slack,
)
from .poh_utils import is_registered_on_poh
-from .router import HackathonEventSerializer, HackathonProjectSerializer, TribesSerializer, TribesTeamSerializer
+from .router import HackathonEventSerializer, TribesSerializer
from .utils import (
apply_new_bounty_deadline, get_bounty, get_bounty_id, get_context, get_custom_avatars, get_hackathon_events,
get_hackathons_page_default_tabs, get_unrated_bounties_count, get_web3, has_tx_mined, is_valid_eth_address,
@@ -164,7 +147,6 @@
@protected_resource()
def oauth_connect(request, *args, **kwargs):
active_user_profile = Profile.objects.filter(user_id=request.user.id).select_related()[0]
- from marketing.utils import should_suppress_notification_email
user_profile = {
"login": active_user_profile.handle,
"email": active_user_profile.user.email,
@@ -280,8 +262,8 @@ def record_bounty_activity(bounty, user, event_name, interest=None, fulfillment=
def helper_handle_access_token(request, access_token):
# https://gist.github.com/owocki/614a18fbfec7a5ed87c97d37de70b110
# interest API via token
- github_user_data = get_github_user_data(access_token)
- request.session['handle'] = github_user_data['login']
+ github_user_data = get_user(token=access_token)
+ request.session['handle'] = github_user_data.login
profile = Profile.objects.filter(handle=request.session['handle'].lower()).first()
request.session['profile_id'] = profile.pk
@@ -364,9 +346,9 @@ def new_interest(request, bounty_id):
access_token = request.GET.get('token')
if access_token:
helper_handle_access_token(request, access_token)
- github_user_data = get_github_user_data(access_token)
+ github_user_data = get_user(access_token)
profile = Profile.objects.prefetch_related('bounty_set') \
- .filter(handle=github_user_data['login'].lower()).first()
+ .filter(handle=github_user_data.login.lower()).first()
profile_id = profile.pk
else:
profile = request.user.profile if profile_id else None
@@ -601,8 +583,8 @@ def remove_interest(request, bounty_id):
access_token = request.GET.get('token')
if access_token:
helper_handle_access_token(request, access_token)
- github_user_data = get_github_user_data(access_token)
- profile = Profile.objects.filter(handle=github_user_data['login'].lower()).first()
+ github_user_data = get_user(access_token)
+ profile = Profile.objects.filter(handle=github_user_data.login.lower()).first()
profile_id = profile.pk
if not profile_id:
@@ -823,6 +805,7 @@ def uninterested(request, bounty_id, profile_id):
def onboard_avatar(request):
return redirect('/onboard/contributor?steps=avatar')
+
def onboard(request, flow=None):
"""Handle displaying the first time user experience flow."""
if flow not in ['funder', 'contributor', 'profile']:
@@ -908,6 +891,7 @@ def users_directory(request):
return TemplateResponse(request, 'dashboard/users.html', params)
+
@csrf_exempt
@staff_member_required
def user_lookup(request):
@@ -920,28 +904,13 @@ def user_lookup(request):
from proxy.views import proxy_view
return proxy_view(request, remote_url)
+
@staff_member_required
def users_directory_elastic(request):
"""Handle displaying users directory page."""
from retail.utils import programming_languages, programming_languages_full
messages.info(request, 'The Andrew-era user directory has been deprecated, please contact the #product-data channel if you need something')
return redirect('/users')
- keywords = programming_languages + programming_languages_full
-
- params = {
- 'is_staff': request.user.is_staff,
- 'avatar_url': request.build_absolute_uri(static('v2/images/twitter_cards/tw_cards-07.png')) ,
- 'active': 'users',
- 'title': 'Users',
- 'meta_title': "",
- 'meta_description': "",
- 'keywords': keywords
- }
-
- if request.path == '/tribes/explore':
- params['explore'] = 'explore_tribes'
-
- return TemplateResponse(request, 'dashboard/users-elastic.html', params)
def users_fetch_filters(profile_list, skills, bounties_completed, leaderboard_rank, rating, organisation, hackathon_id = "", only_with_tokens = False):
@@ -1048,6 +1017,7 @@ def output_users_to_csv(request):
return JsonResponse({'message' : 'Your request is processing and will be delivered to your email'})
+
@require_GET
def users_fetch(request):
"""Handle displaying users."""
@@ -1127,26 +1097,6 @@ def users_fetch(request):
only_with_tokens
)
- def previous_worked():
- if current_user.profile.persona_is_funder:
- return Count(
- 'fulfilled',
- filter=Q(
- fulfilled__bounty__network=network,
- fulfilled__accepted=True,
- fulfilled__bounty__bounty_owner_github_username__iexact=current_user.profile.handle
- )
- )
-
- return Count(
- 'bounties_funded__fulfillments',
- filter=Q(
- bounties_funded__fulfillments__bounty__network=network,
- bounties_funded__fulfillments__accepted=True,
- bounties_funded__fulfillments__profile__handle=current_user.profile.handle
- )
- )
-
if request.GET.get('type') == 'explore_tribes':
profile_list = Profile.objects.filter(is_org=True).order_by('-follower_count', 'id')
@@ -1946,7 +1896,6 @@ def helper_handle_release_bounty_to_public(request, bounty):
messages.warning(request, _('This functionality is only for reserved bounties'))
-
@login_required
def bounty_invite_url(request, invitecode):
"""Decode the bounty details and redirect to correct bounty
@@ -2116,14 +2065,14 @@ def funder_payout_reminder(request, bounty_network, stdbounties_id):
access_token = request.user.profile.get_access_token()
else:
access_token = request.session.get('access_token')
- github_user_data = get_github_user_data(access_token)
+ github_user_data = get_user(access_token)
try:
bounty = Bounty.objects.current().filter(network=bounty_network, standard_bounties_id=stdbounties_id).first()
except Bounty.DoesNotExist:
raise Http404
- has_fulfilled = bounty.fulfillments.filter(profile__handle=github_user_data['login']).count()
+ has_fulfilled = bounty.fulfillments.filter(profile__handle=github_user_data.login).count()
if has_fulfilled == 0:
return JsonResponse({
'success': False,
@@ -2183,12 +2132,6 @@ def profile_details(request, handle):
except (ProfileNotFoundException, ProfileHiddenException):
raise Http404
- if not settings.DEBUG:
- network = 'mainnet'
- else:
- network = 'rinkeby'
-
-
response = {
'avatar': profile.avatar_url,
'handle': profile.handle,
@@ -2248,7 +2191,6 @@ def user_card(request, handle):
if response.get('profile',{}).get('data',{}).get('email'):
del response['profile']['data']['email']
-
return JsonResponse(response, safe=False)
@@ -2285,7 +2227,6 @@ def profile_quests(request, handle):
from quests.models import QuestPointAward
qpas = QuestPointAward.objects.filter(profile=profile).order_by('created_on')
- history = []
response = """date,close"""
balances = {}
@@ -2302,11 +2243,9 @@ def profile_quests(request, handle):
for datestr, balance in balances.items():
response += f"\n{datestr},{balance}"
- mimetype = 'text/x-csv'
return HttpResponse(response)
-
def profile_grants(request, handle):
"""Display profile grant contribution details.
@@ -2321,7 +2260,6 @@ def profile_grants(request, handle):
from grants.models import Contribution
contributions = Contribution.objects.filter(subscription__contributor_profile=profile).order_by('-pk')
- history = []
response = """date,close"""
balances = {}
@@ -2336,7 +2274,6 @@ def profile_grants(request, handle):
for datestr, balance in balances.items():
response += f"\n{datestr},{balance}"
- mimetype = 'text/x-csv'
return HttpResponse(response)
@@ -2403,7 +2340,6 @@ def profile_ratings(request, handle, attr):
balance = balance['sum'] / balance['count']
response += f"\n{datestr},{balance}"
- mimetype = 'text/x-csv'
return HttpResponse(response)
@@ -2440,7 +2376,6 @@ def profile_earnings(request, handle, direction='to'):
for datestr, balance in balances.items():
response += f"\n{datestr},{balance}"
- mimetype = 'text/x-csv'
return HttpResponse(response)
@@ -2471,7 +2406,6 @@ def profile_viewers(request, handle):
for datestr, balance in balances.items():
response += f"\n{datestr},{balance}"
- mimetype = 'text/x-csv'
return HttpResponse(response)
@@ -2517,6 +2451,7 @@ def profile_job_opportunity(request, handle):
}
return JsonResponse(response)
+
@require_POST
@login_required
def profile_settings(request):
@@ -2547,6 +2482,7 @@ def profile_settings(request):
return JsonResponse(response, status=response.get('status', 200))
+
@require_POST
@login_required
def profile_backup(request):
@@ -2609,6 +2545,7 @@ def profile_backup(request):
return JsonResponse(response, status=response.get('status', 200))
+
@require_POST
@login_required
def profile_tax_settings(request, handle):
@@ -3055,6 +2992,7 @@ def get_profile_tab(request, profile, tab, prev_context):
raise Http404
return context
+
def get_profile_by_idena_token(token):
handle = get_handle_by_idena_token(token)
try:
@@ -3062,6 +3000,7 @@ def get_profile_by_idena_token(token):
except ObjectDoesNotExist:
return None
+
def logout_idena(request, handle):
is_logged_in_user = request.user.is_authenticated and request.user.username.lower() == handle.lower()
@@ -3090,6 +3029,7 @@ def logout_idena(request, handle):
'icon_path': static('v2/images/project_logos/idena.svg'),
})
+
# Response model differ from rest of project because idena client excepts this shape:
# Using {success, error} instead of {ok, msg}
@csrf_exempt # Call from idena client
@@ -3150,6 +3090,7 @@ def start_session_idena(request, handle):
}
})
+
# Response model differ from rest of project because idena client excepts this shape:
# Using {success, error} instead of {ok, msg}
@csrf_exempt # Call from idena client
@@ -3199,6 +3140,7 @@ def authenticate_idena(request, handle):
}
})
+
@login_required
def recheck_idena_status(request, handle):
is_logged_in_user = request.user.is_authenticated and request.user.username.lower() == handle.lower()
@@ -3223,6 +3165,7 @@ def recheck_idena_status(request, handle):
'icon_path': 'https://robohash.org/%s' % profile.idena_address if profile.is_idena_connected else static('v2/images/project_logos/idena.svg'),
})
+
def verify_text_for_tweet(handle):
url = 'https://gitcoin.co/' + handle
msg = 'I am verifying my identity as ' + handle + ' on @gitcoin'
@@ -3518,6 +3461,7 @@ def request_verify_google(request, handle):
)
return redirect(authorization_url)
+
@login_required
@require_GET
def verify_user_google(request):
@@ -4227,6 +4171,7 @@ def terms(request):
}
return TemplateResponse(request, 'legal/terms.html', context)
+
def privacy(request):
return TemplateResponse(request, 'legal/privacy.html', {})
@@ -4351,6 +4296,7 @@ def new_hackathon_bounty(request, hackathon=''):
)
return TemplateResponse(request, 'dashboard/hackathon/new_bounty.html', params)
+
@csrf_exempt
def get_suggested_contributors(request):
previously_worked_developers = []
@@ -4650,6 +4596,7 @@ def get_kudos(request):
mimetype = 'application/json'
return HttpResponse(data, mimetype)
+
@login_required
def hackathon_prizes(request, hackathon=''):
profile = request.user.profile
@@ -5179,7 +5126,6 @@ def hackathon_save_project(request):
if p in video_url:
kwargs['extra']['video_provider'] = p
-
if categories:
kwargs['categories'] = categories
@@ -5700,7 +5646,6 @@ def funder_dashboard(request, bounty_type):
for b in bounties], safe=False)
-
def contributor_dashboard(request, bounty_type):
"""JSON data for the contributor dashboard"""
@@ -5885,8 +5830,6 @@ def join_tribe(request, handle):
)
-
-
@csrf_exempt
@require_POST
def tribe_leader(request):
@@ -6025,6 +5968,7 @@ def save_tribe(request,handle):
status=500
)
+
@csrf_exempt
@require_POST
def create_bounty_v1(request):
@@ -6126,7 +6070,7 @@ def create_bounty_v1(request):
# bounty github data
try:
kwargs = get_url_dict(bounty.github_url)
- bounty.github_issue_details = get_gh_issue_details(**kwargs)
+ bounty.github_issue_details = get_issue_details(**kwargs)
except Exception as e:
logger.error(e)
@@ -6622,7 +6566,6 @@ def close_bounty_v1(request, bounty_id):
return JsonResponse(response)
-
@staff_member_required
def bulkemail(request):
handles = request.POST.get('handles', '')
@@ -7193,6 +7136,7 @@ def file_upload(request):
return JsonResponse(data)
+
@csrf_exempt
def mautic_api(request, endpoint=''):
diff --git a/app/dataviz/d3_views.py b/app/dataviz/d3_views.py
index 75c8ae929f8..60f81d375cc 100644
--- a/app/dataviz/d3_views.py
+++ b/app/dataviz/d3_views.py
@@ -455,110 +455,6 @@ def helper_hide_pii(username, num_chars=3):
return new_username
-def viz_graph_data_helper(_type, keyword, hide_pii):
- # setup response
- output = {"nodes": [], "links": []}
-
- # gather info
- types = {}
- names = {}
- values = {}
- avatars = {}
- edges = []
- bounties = Bounty.objects.current().filter(network='mainnet')
- if keyword:
- bounties = bounties.filter(raw_data__icontains=keyword)
-
- for bounty in bounties:
- if bounty.value_in_usdt_then:
- weight = bounty.value_in_usdt_then
- source = bounty.org_name
- if source:
- for fulfillment in bounty.fulfillments.all():
- created = fulfillment.created_on.strftime("%s")
- if _type != 'fulfillments_accepted_only' or fulfillment.accepted:
- target = fulfillment.fulfiller_github_username.lower()
- if hide_pii:
- target = helper_hide_pii(target)
- types[source] = 'source'
- types[target] = 'target_accepted' if fulfillment.accepted else 'target'
- names[source] = None
- names[target] = None
- edges.append((source, target, weight, created))
-
- value = values.get(source, 0)
- value += weight
- values[source] = value
- value = values.get(target, 0)
- value += weight
- values[target] = value
-
- for tip in Tip.objects.filter(network='mainnet'):
- weight = tip.value_in_usdt
- created = tip.created_on.strftime("%s")
- if weight:
- source = tip.username.lower()
- if hide_pii:
- source = helper_hide_pii(source)
- target = tip.from_username.lower()
- if hide_pii:
- target = helper_hide_pii(target)
- if source and target:
- if source not in names.keys():
- types[source] = 'source'
- names[source] = None
- if source not in types.keys():
- types[target] = 'target'
- names[target] = None
- edges.append((source, target, weight, created))
-
- if _type in ['what_future_could_look_like', 'all']:
- last_node = None
- created = 1525147679
- nodes = Profile.objects.exclude(github_access_token='').all()
- for profile in nodes:
- node = profile.handle.lower()
- if hide_pii:
- node = helper_hide_pii(node)
- if node not in names.keys():
- names[node] = None
- types[node] = 'independent'
- if last_node and _type == 'what_future_could_look_like': # and random.randint(0, 2) == 0:
- weight = random.randint(1, 10)
- # edges.append((node, last_node, weight))
- # edges.append((nodes.order_by('?').first().handle.lower(), node, weight))
- target = nodes.order_by('?').first().handle.lower()
- if hide_pii:
- target = helper_hide_pii(target)
- edges.append((target, node, weight, created))
- last_node = node
-
- for key, val in values.items():
- if val > 40:
- avatar_key = key if key and "*" not in key else "None"
- avatars[key] = f'https://gitcoin.co/dynamic/avatar/{avatar_key}'
-
- # build output
- for name in set(names.keys()):
- names[name] = len(output['nodes'])
- value = int(math.sqrt(math.sqrt(values.get(name, 1))))
- output['nodes'].append({"name": name, 'value': value, 'type': types.get(name), 'avatar': avatars.get(name)})
- for edge in edges:
- source, target, weight, created = edge
- weight = math.sqrt(weight)
- if names.get(source) and names.get(target):
- source = names[source]
- target = names[target]
- output['links'].append({
- 'source': source,
- 'target': target,
- 'value': value,
- 'weight': weight,
- 'created': created,
- })
- return output
-
-
def get_all_type_options():
return ['fulfillments_accepted_only', 'all', 'fulfillments', 'what_future_could_look_like']
@@ -688,33 +584,6 @@ def viz_scatterplot(request, key='hourly_rate', template='dataviz/scatterplot.ht
return viz_scatterplot_helper(request, key, template, hide_usernames)
-def viz_scatterplot_data_helper(keyword, hide_usernames=False):
- rows = [['hourlyRate', 'daysBack', 'username', 'weight']]
- fulfillments = BountyFulfillment.objects.filter(accepted=True).exclude(fulfiller_hours_worked=None)
- if keyword:
- filter_bounties = Bounty.objects.filter(raw_data__icontains=keyword)
- fulfillments = fulfillments.filter(bounty__in=filter_bounties)
- for bf in fulfillments:
- #print(bf.pk, bf.created_on)
- try:
- weight = math.log(bf.bounty.value_in_usdt, 10) / 4
- username = bf.bounty.org_name
- if hide_usernames:
- username = "repo: " + helper_hide_pii(username.lower(), 1)
- row = [str(bf.bounty.hourly_rate), str((timezone.now() - bf.accepted_on).days), username, str(weight), ]
- if bf.bounty.hourly_rate:
- rows.append(row)
- except Exception:
- pass
-
- output_rows = []
- for row in rows:
- output_rows.append(",".join(row))
-
- output = "\n".join(output_rows)
- return output
-
-
def is_an_edge(handle, edges):
for edge in edges:
if handle == edge[0]:
diff --git a/app/economy/tx.py b/app/economy/tx.py
index 1c55925377d..c899875fbe2 100644
--- a/app/economy/tx.py
+++ b/app/economy/tx.py
@@ -1,19 +1,13 @@
-import decimal
-import os
-import time
from decimal import Decimal
-from time import sleep
from django.conf import settings
from django.utils import timezone
import requests
-from bs4 import BeautifulSoup
from dashboard.abi import erc20_abi
from dashboard.utils import get_tx_status, get_web3
from economy.models import Token
-from hexbytes import HexBytes
-from web3 import HTTPProvider, Web3
+from web3 import Web3
from web3.exceptions import BadFunctionCallOutput
@@ -92,14 +86,6 @@ def transaction_status(transaction, txid):
maybeprint(89, e)
-def check_transaction_contract(transaction_tax):
- transaction = check_transaction(transaction_tax)
- if transaction is not None:
- token_address = check_token(transaction.to)
- if token_address is not False and not token_address == '0x0000000000000000000000000000000000000000':
- return transaction_status(transaction, transaction_tax)
-
-
def get_token(token_symbol, network):
"""
For a given token symbol and amount, returns the token's details. For ETH, we change the
@@ -135,13 +121,6 @@ def check_for_replaced_tx(tx_hash, network):
return tx_hash, status, timestamp
-def is_bulk_checkout_tx(receipt):
- """
- Returns true if the to address of the recipient is the bulk checkout contract
- """
- to_address = receipt['to'].lower()
- is_bulk_checkout = to_address == bulk_checkout_address.lower()
- return is_bulk_checkout
def grants_transaction_validator(contribution, w3):
"""
@@ -203,16 +182,6 @@ def grants_transaction_validator(contribution, w3):
# Validator currently assumes msg.sender == originator as described above
response['originator'] = [ receipt['from'] ]
- # The below check was commented out since it wrongly fails for transactions sent via Argent
- # and other wallets that use meta-transactions or relayers
-
- # # Return if recipient is not the BulkCheckout contract
- # is_bulk_checkout = is_bulk_checkout_tx(receipt)
- # if not is_bulk_checkout:
- # to_address = receipt['to']
- # response['validation']['comment'] = f'This function only validates transactions through the BulkCheckout contract, but this transaction was sent to {to_address}'
- # return response
-
# Parse receipt logs to look for expected transfer info. We don't need to distinguish
# between ETH and token transfers, and don't need to look at any other receipt parameters,
# because all contributions are emitted as an event
@@ -341,98 +310,3 @@ def get_token_recipient_senders(recipient_address, token_address):
headers = {'Authorization': f'Bearer {auth}'}
validation_threshold_pct = 0.05
validation_threshold_total = 0.05
-
-def get_token_originators(to_address, token, from_address='', return_what='transfers', tx_id='', amounts=[]):
- address = to_address
-
- #is_address = requests.get('https://api.aleth.io/v1/accounts/' + address, headers=headers).status_code
-
- #if is_address != requests.codes.ok:
- # raise ValueError('Address provided is not valid.')
-
- #is_token = requests.get(
- # 'https://api.aleth.io/v1/tokens/' + (token),
- # headers=headers
- #).status_code
-
- #if is_token != requests.codes.ok and token != '0x0':
- # raise ValueError('Token provided is not valid.')
-
- #balance = 0
- #try:
- #url = 'https://api.aleth.io/v1/token-balances?filter[account]=' + address + '&filter[token]=' + token
- #balance = requests.get(url, headers=headers).json()['data'][0]['attributes']['balance']
- # pass
- #if balance == 0:
- # raise ValueError('No balance of token at address provided.')
- #except Exception as e:
- # maybeprint(250, e)
-
- endpoint = 'token-transfers' if token != '0x0' else 'ether-transfers'
- url = f'https://api.aleth.io/v1/{endpoint}?filter[to]=' + address + '&filter[token]=' + token + '&page%5Blimit%5D=100'
- if token == '0x0':
- url = f'https://api.aleth.io/v1/{endpoint}?filter[account]=' + address + '&page%5Blimit%5D=100'
- if from_address:
- url += '&filter[from]=' + from_address
-
- # OLD: THIS REQUEST THROWS WITH A 500 INTERNAL SERVER ERROR
- transfers = requests.get(
- url,
- headers=headers
- ).json()
-
- # NEW: PARSE EVENT LOGS TO SEE WHAT'S GOING ON
-
- if transfers.get('message') == 'API rate limit exceeded. Please upgrade your account.':
- raise Exception("RATE LIMIT EXCEEDED")
- # TODO - pull more than one page in case there are many transfers.
-
- if return_what == 'transfers':
- for transfer in transfers.get('data', {}):
- this_is_the_one = tx_id and tx_id.lower() in str(transfer).lower()
- _decimals = transfer.get('attributes', {}).get('decimals', 18)
- _symbol = transfer.get('attributes', {}).get('symbol', 'ETH')
- _value = transfer.get('attributes', {}).get('value', 0)
- _value_decimal = Decimal(int(_value) / 10 ** _decimals)
- _this_is_the_one = False
- for amount in amounts:
- delta = abs(float(abs(_value_decimal)) - float(abs(amount)))
- threshold = (float(abs(amount)) * validation_threshold_pct)
- if delta < threshold or delta < validation_threshold_total:
- _this_is_the_one = True
- this_is_the_one = not len(amounts) or _this_is_the_one
- if this_is_the_one:
- if transfer.get('type') in ['TokenTransfer', 'EtherTransfer']:
- return {
- 'token_amount_decimal': _value_decimal,
- 'token_name': _symbol,
- 'to': address,
- 'token_address': token,
- 'token_amount_int': int(transfer['attributes']['value']),
- 'decimals': _decimals,
- }
- return None
-
- # TokenTransfer events, value field
- try:
- originators = []
- xfrs = transfers.get('data', {})
- for tx in xfrs:
- if tx.get('type') == 'TokenTransfer':
- response = tx['relationships']['from']['data']['id']
- # hack to save time
- if response != to_address:
- return [response]
- #originators.append(response)
- value = int(tx.get('attributes', {}).get('value', 0))
- if tx.get('type') == 'EtherTransfer' and value > 0 and token == '0x0':
- response = tx['relationships']['from']['data']['id']
- if response != to_address:
- # hack to save time
- return [response]
- originators.append(response)
-
- return list(set(originators))
- except Exception as e:
- maybeprint('284', e)
- return []
diff --git a/app/economy/utils.py b/app/economy/utils.py
index 3aa89288ae8..8ec0acd8a17 100644
--- a/app/economy/utils.py
+++ b/app/economy/utils.py
@@ -17,17 +17,9 @@
along with this program. If not, see .
"""
-from cacheops import cached_as
from economy.models import ConversionRate
-# All Units in native currency
-class TransactionException(Exception):
- """Handle general transaction exceptions."""
-
- pass
-
-
class ConversionRateNotFoundError(Exception):
"""Thrown if ConversionRate not found."""
diff --git a/app/faucet/templates/bulk_DM.html b/app/faucet/templates/bulk_DM.html
deleted file mode 100644
index 75976fe2b78..00000000000
--- a/app/faucet/templates/bulk_DM.html
+++ /dev/null
@@ -1,59 +0,0 @@
-{% extends "admin/base_site.html" %}
-{% comment %}
- Copyright (C) 2021 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 .
-
-{% endcomment %}
-
-{% load i18n static bundle %}
-
-{% block extrastyle %}{{ block.super }}
- {% bundle css file admin_dashboard %}
-
- {% endbundle %}
-{% endblock %}
-
-{% block coltype %}colMS{% endblock %}
-
-{% block bodyclass %}{{ block.super }} dashboard{% endblock %}
-
-{% block breadcrumbs %}{% endblock %}
-
-{% block content %}
-
-
-
{% trans "Send Bulk DMs" %} {{obj.pk}}
-
-
-
-
-
-
-
-{% endblock %}
-{% block extrahead %}{{ block.super }}
- {% include 'shared/footer_scripts.html' %}
-{% endblock %}
diff --git a/app/faucet/templates/shared/faucet_no_metamask_error.html b/app/faucet/templates/shared/faucet_no_metamask_error.html
deleted file mode 100644
index cdbe4730051..00000000000
--- a/app/faucet/templates/shared/faucet_no_metamask_error.html
+++ /dev/null
@@ -1,39 +0,0 @@
-{% comment %}
- Copyright (C) 2021 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 .
-
-{% endcomment %}
-{% load i18n static %}
-
-
-
{% trans "Apply for a faucet distribution" %}
-
-
-
-
{% trans "To continue, enable Web3." %}
-
- {% trans "Web3 is the same web you know and love, but with Ethereum-enabled functionality." %}
-
-
- {% blocktrans %}The fastest and easiest way to add Web3 to your browser is to install Metamask. To continue submitting a bounty, please install Metamask and return to this page.{% endblocktrans %}
-
diff --git a/app/faucet/templates/shared/faucet_unlock_metamask.html b/app/faucet/templates/shared/faucet_unlock_metamask.html
deleted file mode 100644
index 0bf644b1811..00000000000
--- a/app/faucet/templates/shared/faucet_unlock_metamask.html
+++ /dev/null
@@ -1,36 +0,0 @@
-{% comment %}
- Copyright (C) 2021 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 .
-
-{% endcomment %}
-{% load i18n static %}
-
-
-
{% trans "Apply for a faucet distribution" %}
-
-
-
-
{% trans "You're almost there!" %}
-
- {% trans "In order to continue, you'll need to unlock metamask." %}
-
diff --git a/app/grants/templates/grants/components/hidden_inputs.html b/app/grants/templates/grants/components/hidden_inputs.html
deleted file mode 100644
index 67cba80f791..00000000000
--- a/app/grants/templates/grants/components/hidden_inputs.html
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/grants/templates/grants/detail/funding.html b/app/grants/templates/grants/detail/funding.html
deleted file mode 100644
index 74b2cc5d330..00000000000
--- a/app/grants/templates/grants/detail/funding.html
+++ /dev/null
@@ -1,135 +0,0 @@
-{% comment %}
- Copyright (C) 2021 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 .
-{% endcomment %}
-
-{% load static humanize i18n grants_extra %}
-
-
- {% if not grant.twitter_verified %}
-
-
-
-
-
- Warning: This grant has not verified their ownership of the twitter account listed.
-
diff --git a/app/grants/templates/grants/detail/tabs.html b/app/grants/templates/grants/detail/tabs.html
deleted file mode 100644
index 3894e17da5b..00000000000
--- a/app/grants/templates/grants/detail/tabs.html
+++ /dev/null
@@ -1,385 +0,0 @@
-{% comment %}
- Copyright (C) 2021 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 .
-{% endcomment %}
-{% load static humanize i18n grants_extra %}
-
-
- A grant's SybilScore ™️ is calculated off of the total of suspicious activity on each of the following vectors:
- - Account Metadata
- - Suspicious Interactions
- - Grant Flags Reports
- - BrightID Trust Score (coming soon)
- - KYC (maybe coming soon)
- - MACI (maybe coming soon)
-
- a grant's RiskScore ™️ is equal to its (SybilScore ™️)^2 * sqrt(its matching funds for this round).
-
-
- {% for ele in sybil_profiles%}
-
{{ele.0}}: (avg {{ele.1.1|floatformat:2}})
-
-
-
- Index
-
-
- Contributors
-
-
- Contributors (pct)
-
-
- Contributions/Contributor
-
-
- Profiles
-
-
- {% for sp in ele.1.0 %}
-
-
- {% if '0x' in sp.0 %}
- {{sp.0}}
- {% else %}
- {{sp.0}}
- {% endif %}
-
diff --git a/app/grants/utils.py b/app/grants/utils.py
index a4fd868c667..62058e1a9fb 100644
--- a/app/grants/utils.py
+++ b/app/grants/utils.py
@@ -26,10 +26,9 @@
from random import randint, seed
from secrets import token_hex
-from django.templatetags.static import static
from django.utils import timezone
-from app.settings import BASE_DIR, BASE_URL, MEDIA_URL, NOTION_API_KEY, NOTION_SYBIL_DB, STATIC_HOST, STATIC_URL
+from app.settings import BASE_URL, MEDIA_URL, NOTION_API_KEY, NOTION_SYBIL_DB
from app.utils import notion_write
from avatar.utils import convert_img
from economy.utils import ConversionRateNotFoundError, convert_amount
@@ -94,42 +93,6 @@ def get_upload_filename(instance, filename):
file_path = os.path.basename(filename)
return f"grants/{getattr(instance, '_path', '')}/{salt}/{file_path}"
-
-def get_leaderboard():
- return JSONStore.objects.filter(view='grants', key='leaderboard').order_by('-pk').first().data
-
-
-def generate_grants_leaderboard(max_items=100):
- from grants.models import Subscription, Contribution
- handles = Subscription.objects.exclude(contributor_profile__isnull=True).values_list('contributor_profile__handle', flat=True)
- default_dict = {
- 'rank': None,
- 'no': 0,
- 'sum': 0,
- 'handle': None,
- }
- users_to_results = { ele : default_dict.copy() for ele in handles }
-
- # get all contribution attributes
- for contribution in Contribution.objects.exclude(profile_for_clr__isnull=True).select_related('subscription'):
- key = contribution.subscription.contributor_profile.handle
- users_to_results[key]['handle'] = key
- amount = contribution.subscription.get_converted_amount(False)
- if amount:
- users_to_results[key]['no'] += 1
- users_to_results[key]['sum'] += round(amount)
- # prepare response for view
- items = []
- counter = 1
- for item in sorted(users_to_results.items(), key=lambda kv: kv[1]['sum'], reverse=True):
- item = item[1]
- if item['no']:
- item['rank'] = counter
- items.append(item)
- counter += 1
- return items[:max_items]
-
-
def is_grant_team_member(grant, profile):
"""Checks to see if profile is a grant team member
@@ -190,16 +153,6 @@ def get_user_code(user_id, grant, coding_set=block_codes, length=6):
return ''.join(coding_id)
-def add_grant_to_active_clrs(grant):
- from grants.models import Grant, GrantCLR
-
- active_clr_rounds = GrantCLR.objects.filter(is_active=True)
- for clr_round in active_clr_rounds:
- if clr_round.grants.filter(pk=grant.pk).exists():
- grant.in_active_clrs.add(clr_round)
- grant.save()
-
-
def generate_collection_thumbnail(collection, width, heigth):
grants = collection.grants.all()
profile = collection.profile
diff --git a/app/grants/views.py b/app/grants/views.py
index 54cf9e13b59..5dc04516344 100644
--- a/app/grants/views.py
+++ b/app/grants/views.py
@@ -26,15 +26,13 @@
import time
import uuid
from datetime import datetime
-from decimal import Decimal
from urllib.parse import urlencode
from django.conf import settings
from django.contrib import messages
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.decorators import login_required
-from django.contrib.contenttypes.models import ContentType
-from django.contrib.humanize.templatetags.humanize import intword, naturaltime
+from django.contrib.humanize.templatetags.humanize import intword
from django.core.paginator import EmptyPage, Paginator
from django.db import connection, transaction
from django.db.models import Q, Subquery
@@ -44,7 +42,6 @@
from django.templatetags.static import static
from django.urls import reverse
from django.utils import timezone
-from django.utils.crypto import get_random_string
from django.utils.translation import gettext_lazy as _
from django.views.decorators.cache import cache_page
from django.views.decorators.csrf import csrf_exempt
@@ -97,34 +94,6 @@
kudos_reward_pks = [12580, 12584, 12572, 125868, 12552, 12556, 12557, 125677, 12550, 12392, 12307, 12343, 12156, 12164]
-def get_fund_reward(request, grant):
- token = Token.objects.filter(
- id__in=kudos_reward_pks,
- num_clones_available_counting_indirect_send__gt=0,
- owner_address__iexact='0x6239FF1040E412491557a7a02b2CBcC5aE85dc8F').order_by('?').first()
- if not token:
- return None
- key_len = 25
- _key = get_random_string(key_len)
- btc = BulkTransferCoupon.objects.create(
- token=token,
- num_uses_total=1,
- num_uses_remaining=1,
- current_uses=0,
- secret=_key,
- comments_to_put_in_kudos_transfer=f"Thank you for funding '{grant.title}' on Gitcoin Grants!",
- sender_profile=Profile.objects.get(handle='gitcoinbot'),
- make_paid_for_first_minutes=0,
- )
-
- #store btc on session
- request.session['send_notification'] = 1
- request.session['cta_text'] = "Redeem Kudos"
- request.session['msg_html'] = f"You have received a new {token.ui_name} for your contribution to {grant.title}"
- request.session['cta_url'] = btc.url
-
- return btc
-
def get_keywords():
"""Get all Keywords."""
return json.dumps([str(key) for key in Keyword.objects.all().cache().values_list('keyword', flat=True)])
@@ -1184,18 +1153,6 @@ def grants_by_grant_clr(request, clr_round):
response['X-Frame-Options'] = 'SAMEORIGIN'
return response
-# TODO: REMOVE
-def add_form_categories_to_grant(form_category_ids, grant, grant_type):
- form_category_ids = [int(i) for i in form_category_ids if i != '']
-
- model_categories = basic_grant_categories(grant_type)
- model_categories = [ category[0] for category in model_categories ]
- selected_categories = [model_categories[i] for i in form_category_ids]
-
- for category in selected_categories:
- grant_category = GrantCategory.objects.get_or_create(category=category)[0]
- grant.categories.add(grant_category)
-
def get_grant_sybil_profile(grant_id=None, days_back=None, grant_type=None, index_on=None):
grant_id_sql = f"= {grant_id}" if grant_id else "IS NOT NULL"
@@ -1547,8 +1504,6 @@ def grant_edit(request, grant_id):
is_team_member = is_grant_team_member(grant, profile)
if request.method == 'POST' and (is_team_member or request.user.is_staff):
- from grants.utils import add_grant_to_active_clrs
-
response = {
'status': 400,
'message': 'error: Bad Request. Unable to create grant'
@@ -1744,8 +1699,6 @@ def grant_new(request):
if request.method == 'POST':
- from grants.utils import add_grant_to_active_clrs
-
response = {
'status': 400,
'message': 'error: Bad Request. Unable to create grant'
@@ -2620,8 +2573,6 @@ def create_matching_pledge_v1(request):
)
match_pledge.save()
- # dont' send spammy email
- # new_grant_match_pledge(match_pledge)
response = {
'status': 200,
@@ -2648,10 +2599,6 @@ def invoice(request, contribution_pk):
return TemplateResponse(request, 'grants/invoice.html', params)
-def basic_grant_types():
- result = GrantType.objects.all()
- return [ (ele.name, ele.label) for ele in result ]
-
def basic_grant_categories(name):
result = []
diff --git a/app/inbox/signals.py b/app/inbox/signals.py
index 1e05babedff..400c007efa7 100644
--- a/app/inbox/signals.py
+++ b/app/inbox/signals.py
@@ -26,7 +26,6 @@
from dashboard.models import Activity
from inbox.utils import (
comment_notification, mentioned_users_notification, send_mention_notification_to_users, send_notification_to_user,
- send_notification_to_user_from_gitcoinbot,
)
from townsquare.models import Comment, Like
diff --git a/app/inbox/utils.py b/app/inbox/utils.py
index e0e368ae825..398fee7586f 100644
--- a/app/inbox/utils.py
+++ b/app/inbox/utils.py
@@ -17,9 +17,6 @@
along with this program. If not, see .
"""
-from gettext import gettext
-
-from django.contrib.auth.models import User
from django.template.defaultfilters import truncatechars
from app.utils import get_profiles_from_text
@@ -38,19 +35,6 @@ def send_notification_to_user(from_user, to_user, cta_url, cta_text, msg_html):
)
-def send_notification_to_user_from_gitcoinbot(to_user, cta_url, cta_text, msg_html):
- """Helper method to create a new notification."""
- from_user = User.objects.filter(username='gitcoinbot').first()
- if to_user and from_user:
- Notification.objects.create(
- cta_url=cta_url,
- cta_text=cta_text,
- message_html=msg_html,
- from_user=from_user,
- to_user=to_user
- )
-
-
def send_mention_notification_to_users(activity, mentioned_profiles):
profile = activity.profile
preview_post = truncatechars(activity.metadata.get('title', ''), 80)
diff --git a/app/kudos/helpers.py b/app/kudos/helpers.py
index 8d3f5cc5cda..436f45248e2 100644
--- a/app/kudos/helpers.py
+++ b/app/kudos/helpers.py
@@ -22,8 +22,6 @@
from django.conf import settings
from django.shortcuts import get_object_or_404
-from eth_utils import is_address, to_checksum_address
-
from .models import Contract, Token, Wallet
logger = logging.getLogger(__name__)
@@ -59,48 +57,6 @@ def get_token(token_id, network, address):
return get_object_or_404(Token, contract=contract, token_id=token_id)
-def reconcile_kudos_preferred_wallet(profile):
- """DEPRECATED.
- Helper function to set the kudos_preferred_wallet if it doesn't already exist
-
- Args:
- profile (TYPE): Description
-
- Returns:
- str: Profile wallet address.
-
- """
- # If the preferred_kudos_wallet is not set, figure out how to set it.
- if not profile.preferred_kudos_wallet:
- # If the preferred_payout_address exists, use it for the preferred_kudos_Wallet
- if profile.preferred_payout_address and profile.preferred_payout_address != '0x0':
- # Check if the preferred_payout_addess exists as a kudos wallet address
- kudos_wallet = profile.wallets.filter(address=profile.preferred_payout_address).first()
- if kudos_wallet:
- # If yes, set that wallet to be the profile.preferred_kudos_wallet
- profile.preferred_kudos_wallet = kudos_wallet
- # profile.preferred_kudos_wallet = profile.wallets.filter(address=profile.preferred_payout_address)
- else:
- # Create the kudos_wallet and set it as the preferred_kudos_wallet in the profile
- new_kudos_wallet = Wallet(address=profile.preferred_payout_address)
- new_kudos_wallet.save()
- profile.preferred_kudos_wallet = new_kudos_wallet
- else:
- # Check if there are any kudos_wallets available. If so, set the first one to preferred.
- kudos_wallet = profile.kudos_wallets.all()
- if kudos_wallet:
- profile.preferred_kudos_wallet = kudos_wallet.first()
- else:
- # Not enough information available to set the preferred_kudos_wallet
- # Use kudos indrect send.
- logger.warning('No kudos wallets or preferred_payout_address address found. Use Kudos Indirect Send.')
- return None
-
- profile.save()
-
- return profile.preferred_kudos_wallet
-
-
def re_send_kudos_transfer(kt, override_with_xdai_okay):
from dashboard.utils import get_web3, has_tx_mined
from gas.utils import recommend_min_gas_price_to_confirm_in_time
diff --git a/app/kudos/management/commands/process_pending_kudos_distributions.py b/app/kudos/management/commands/process_pending_kudos_distributions.py
index 34d40edb5e8..bdc6a86d77c 100644
--- a/app/kudos/management/commands/process_pending_kudos_distributions.py
+++ b/app/kudos/management/commands/process_pending_kudos_distributions.py
@@ -16,11 +16,8 @@
along with this program. If not, see .
"""
-import logging
import time
-import warnings
-from django.conf import settings
from django.core.management.base import BaseCommand
from kudos.models import KudosTransfer
diff --git a/app/kudos/management/commands/re_mint_kudos_on_xdai.py b/app/kudos/management/commands/re_mint_kudos_on_xdai.py
index 4a249846948..38ccb80ff9b 100644
--- a/app/kudos/management/commands/re_mint_kudos_on_xdai.py
+++ b/app/kudos/management/commands/re_mint_kudos_on_xdai.py
@@ -16,11 +16,6 @@
along with this program. If not, see .
"""
-import logging
-import time
-import warnings
-
-from django.conf import settings
from django.core.management.base import BaseCommand
from dashboard.models import Profile
diff --git a/app/kudos/models.py b/app/kudos/models.py
index 0a1ade92c86..35e47af5bed 100644
--- a/app/kudos/models.py
+++ b/app/kudos/models.py
@@ -33,12 +33,10 @@
from django.utils.text import slugify
import environ
-import pyvips
from dashboard.models import SendCryptoAsset
from economy.models import SuperModel
from eth_utils import to_checksum_address
from gas.utils import recommend_min_gas_price_to_confirm_in_time
-from pyvips.error import Error as VipsError
from unidecode import unidecode
logger = logging.getLogger(__name__)
diff --git a/app/kudos/tasks.py b/app/kudos/tasks.py
index fa5bc015610..489f46cd967 100644
--- a/app/kudos/tasks.py
+++ b/app/kudos/tasks.py
@@ -10,7 +10,6 @@
from celery.utils.log import get_task_logger
from dashboard.utils import get_web3, has_tx_mined
from gas.utils import recommend_min_gas_price_to_confirm_in_time
-from hexbytes import HexBytes
from kudos.models import KudosTransfer, TokenRequest
from kudos.utils import kudos_abi
from marketing.mails import notify_kudos_minted, send_mail
diff --git a/app/kudos/templates/shared/kudos_banner.html b/app/kudos/templates/shared/kudos_banner.html
deleted file mode 100644
index acc64eccd2c..00000000000
--- a/app/kudos/templates/shared/kudos_banner.html
+++ /dev/null
@@ -1,20 +0,0 @@
-{% comment %}
- Copyright (C) 2021 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 .
-{% endcomment %}
-{% load static %}
-
-
-
diff --git a/app/kudos/test_models.py b/app/kudos/test_models.py
deleted file mode 100644
index 8230b06a828..00000000000
--- a/app/kudos/test_models.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Test the Kudos models.
-
-Copyright (C) 2021 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 .
-"""
-import logging
-import unittest
-
-from django.test import Client, TestCase
diff --git a/app/kudos/test_utils.py b/app/kudos/test_utils.py
index 2cc01e96a7e..8c6e636bed4 100644
--- a/app/kudos/test_utils.py
+++ b/app/kudos/test_utils.py
@@ -19,7 +19,7 @@
import logging
import unittest
-from django.test import Client, TestCase
+from django.test import TestCase
from .utils import KudosContract
diff --git a/app/kudos/test_views.py b/app/kudos/test_views.py
index 8595e007847..f4a8d072689 100644
--- a/app/kudos/test_views.py
+++ b/app/kudos/test_views.py
@@ -17,7 +17,6 @@
along with this program. If not, see .
"""
import logging
-from unittest import skip
from django.test import Client, TestCase
@@ -62,10 +61,6 @@ def test_mint(self):
r = self.client.get('/kudos/mint/')
self.assertEqual(r.status_code, 200)
- # @skip(reason='stub for future testing')
- # def test_get_to_emails(self):
- # self.client.get('/kudos/1')
-
# @skip(reason='stub for future testing')
# def test_kudos_preferred_wallet(self):
# self.client.get('/kudos/1')
diff --git a/app/kudos/utils.py b/app/kudos/utils.py
index 1b5c2af8b2a..9f51d954f4c 100644
--- a/app/kudos/utils.py
+++ b/app/kudos/utils.py
@@ -93,38 +93,6 @@ class KudosError(Exception):
pass
-class KudosTransferNotFound(KudosError):
- """Exception is raised when web3 and the database are out of sync.
-
- Attributes:
- kudos_id -- the kudos id that has mismatched data
- message -- explanation of the error
-
- """
-
- def __init__(self, kudos_id, message):
- self.kudos_id = kudos_id
- self.message = message
-
-
-class KudosMismatch(KudosError):
- """Exception is raised when web3 and the database are out of sync.
-
- Attributes:
- kudos_id: The kudos id that has mismatched data.
- kudos_web3: Kudos attributes on web3.
- kudos_db: Kudos attritubes in the database.
- message: Explanation of the error.
-
- """
-
- def __init__(self, kudos_id, kudos_web3, kudos_db, message):
- self.kudos_id = kudos_id
- self.kudos_web3 = kudos_web3
- self.kudos_db = kudos_db
- self.message = message
-
-
class KudosContract:
"""A class represending the Kudos.sol contract.
@@ -345,8 +313,6 @@ def sync_db(self, kudos_id, txid):
# Only warn for a Kudos that is cloned/transfered, not a Gen0 Kudos.
if kudos_token.num_clones_allowed == 0:
logger.warning(f'No KudosTransfer object found for Kudos ID {kudos_id}')
- # raise KudosTransferNotFound(kudos_id, 'No KudosTransfer object found')
- # raise
except KudosTransfer.MultipleObjectsReturned:
pass
@@ -646,31 +612,5 @@ def create_token_uri_url(self, **kwargs):
return f'{settings.IPFS_API_SCHEME}://{settings.IPFS_HOST}:{settings.IPFS_API_PORT}/api/v0/cat/{ipfs_hash}'
-def get_to_emails(params):
- """Get a list of email address to send the alert to, in this priority:
-
- 1. get_emails_master() pulls email addresses from the user's public Github account.
- 2. If an email address is included in the Tips/Kudos form, append that to the email list.
-
-
- Args:
- params (dict): A dictionary parsed form the POST request. Typically this is a POST
- request coming in from a Tips/Kudos send.
-
- Returns:
- list: An array of email addresses to send the email to.
-
- """
- to_emails = []
-
- to_username = params['username'].lstrip('@')
- to_emails = get_emails_master(to_username)
-
- if params.get('email'):
- to_emails.append(params['email'])
-
- return list(set(to_emails))
-
-
def kudos_abi():
return [{'constant': True, 'inputs': [{'name': '_interfaceId', 'type': 'bytes4'}], 'name': 'supportsInterface', 'outputs': [{'name': '', 'type': 'bool'}], 'payable': False, 'stateMutability': 'view', 'type': 'function'}, {'constant': True, 'inputs': [], 'name': 'name', 'outputs': [{'name': '', 'type': 'string'}], 'payable': False, 'stateMutability': 'view', 'type': 'function'}, {'constant': True, 'inputs': [{'name': '_tokenId', 'type': 'uint256'}], 'name': 'getApproved', 'outputs': [{'name': '', 'type': 'address'}], 'payable': False, 'stateMutability': 'view', 'type': 'function'}, {'constant': False, 'inputs': [{'name': '_to', 'type': 'address'}, {'name': '_tokenId', 'type': 'uint256'}], 'name': 'approve', 'outputs': [], 'payable': False, 'stateMutability': 'nonpayable', 'type': 'function'}, {'constant': True, 'inputs': [], 'name': 'cloneFeePercentage', 'outputs': [{'name': '', 'type': 'uint256'}], 'payable': False, 'stateMutability': 'view', 'type': 'function'}, {'constant': True, 'inputs': [], 'name': 'totalSupply', 'outputs': [{'name': '', 'type': 'uint256'}], 'payable': False, 'stateMutability': 'view', 'type': 'function'}, {'constant': True, 'inputs': [], 'name': 'InterfaceId_ERC165', 'outputs': [{'name': '', 'type': 'bytes4'}], 'payable': False, 'stateMutability': 'view', 'type': 'function'}, {'constant': False, 'inputs': [{'name': '_from', 'type': 'address'}, {'name': '_to', 'type': 'address'}, {'name': '_tokenId', 'type': 'uint256'}], 'name': 'transferFrom', 'outputs': [], 'payable': False, 'stateMutability': 'nonpayable', 'type': 'function'}, {'constant': True, 'inputs': [{'name': '_owner', 'type': 'address'}, {'name': '_index', 'type': 'uint256'}], 'name': 'tokenOfOwnerByIndex', 'outputs': [{'name': '', 'type': 'uint256'}], 'payable': False, 'stateMutability': 'view', 'type': 'function'}, {'constant': False, 'inputs': [{'name': '_from', 'type': 'address'}, {'name': '_to', 'type': 'address'}, {'name': '_tokenId', 'type': 'uint256'}], 'name': 'safeTransferFrom', 'outputs': [], 'payable': False, 'stateMutability': 'nonpayable', 'type': 'function'}, {'constant': True, 'inputs': [], 'name': 'isMintable', 'outputs': [{'name': '', 'type': 'bool'}], 'payable': False, 'stateMutability': 'view', 'type': 'function'}, {'constant': True, 'inputs': [{'name': '_tokenId', 'type': 'uint256'}], 'name': 'exists', 'outputs': [{'name': '', 'type': 'bool'}], 'payable': False, 'stateMutability': 'view', 'type': 'function'}, {'constant': True, 'inputs': [{'name': '_index', 'type': 'uint256'}], 'name': 'tokenByIndex', 'outputs': [{'name': '', 'type': 'uint256'}], 'payable': False, 'stateMutability': 'view', 'type': 'function'}, {'constant': True, 'inputs': [{'name': '_tokenId', 'type': 'uint256'}], 'name': 'ownerOf', 'outputs': [{'name': '', 'type': 'address'}], 'payable': False, 'stateMutability': 'view', 'type': 'function'}, {'constant': True, 'inputs': [{'name': '_owner', 'type': 'address'}], 'name': 'balanceOf', 'outputs': [{'name': '', 'type': 'uint256'}], 'payable': False, 'stateMutability': 'view', 'type': 'function'}, {'constant': False, 'inputs': [], 'name': 'renounceOwnership', 'outputs': [], 'payable': False, 'stateMutability': 'nonpayable', 'type': 'function'}, {'constant': True, 'inputs': [{'name': '', 'type': 'uint256'}], 'name': 'kudos', 'outputs': [{'name': 'priceFinney', 'type': 'uint256'}, {'name': 'numClonesAllowed', 'type': 'uint256'}, {'name': 'numClonesInWild', 'type': 'uint256'}, {'name': 'clonedFromId', 'type': 'uint256'}], 'payable': False, 'stateMutability': 'view', 'type': 'function'}, {'constant': True, 'inputs': [], 'name': 'owner', 'outputs': [{'name': '', 'type': 'address'}], 'payable': False, 'stateMutability': 'view', 'type': 'function'}, {'constant': True, 'inputs': [], 'name': 'symbol', 'outputs': [{'name': '', 'type': 'string'}], 'payable': False, 'stateMutability': 'view', 'type': 'function'}, {'constant': False, 'inputs': [{'name': '_to', 'type': 'address'}, {'name': '_approved', 'type': 'bool'}], 'name': 'setApprovalForAll', 'outputs': [], 'payable': False, 'stateMutability': 'nonpayable', 'type': 'function'}, {'constant': False, 'inputs': [{'name': '_from', 'type': 'address'}, {'name': '_to', 'type': 'address'}, {'name': '_tokenId', 'type': 'uint256'}, {'name': '_data', 'type': 'bytes'}], 'name': 'safeTransferFrom', 'outputs': [], 'payable': False, 'stateMutability': 'nonpayable', 'type': 'function'}, {'constant': True, 'inputs': [{'name': '_tokenId', 'type': 'uint256'}], 'name': 'tokenURI', 'outputs': [{'name': '', 'type': 'string'}], 'payable': False, 'stateMutability': 'view', 'type': 'function'}, {'constant': True, 'inputs': [{'name': '_owner', 'type': 'address'}, {'name': '_operator', 'type': 'address'}], 'name': 'isApprovedForAll', 'outputs': [{'name': '', 'type': 'bool'}], 'payable': False, 'stateMutability': 'view', 'type': 'function'}, {'constant': False, 'inputs': [{'name': '_newOwner', 'type': 'address'}], 'name': 'transferOwnership', 'outputs': [], 'payable': False, 'stateMutability': 'nonpayable', 'type': 'function'}, {'inputs': [], 'payable': False, 'stateMutability': 'nonpayable', 'type': 'constructor'}, {'anonymous': False, 'inputs': [{'indexed': True, 'name': 'previousOwner', 'type': 'address'}], 'name': 'OwnershipRenounced', 'type': 'event'}, {'anonymous': False, 'inputs': [{'indexed': True, 'name': 'previousOwner', 'type': 'address'}, {'indexed': True, 'name': 'newOwner', 'type': 'address'}], 'name': 'OwnershipTransferred', 'type': 'event'}, {'anonymous': False, 'inputs': [{'indexed': True, 'name': '_from', 'type': 'address'}, {'indexed': True, 'name': '_to', 'type': 'address'}, {'indexed': True, 'name': '_tokenId', 'type': 'uint256'}], 'name': 'Transfer', 'type': 'event'}, {'anonymous': False, 'inputs': [{'indexed': True, 'name': '_owner', 'type': 'address'}, {'indexed': True, 'name': '_approved', 'type': 'address'}, {'indexed': True, 'name': '_tokenId', 'type': 'uint256'}], 'name': 'Approval', 'type': 'event'}, {'anonymous': False, 'inputs': [{'indexed': True, 'name': '_owner', 'type': 'address'}, {'indexed': True, 'name': '_operator', 'type': 'address'}, {'indexed': False, 'name': '_approved', 'type': 'bool'}], 'name': 'ApprovalForAll', 'type': 'event'}, {'constant': False, 'inputs': [{'name': '_to', 'type': 'address'}, {'name': '_priceFinney', 'type': 'uint256'}, {'name': '_numClonesAllowed', 'type': 'uint256'}, {'name': '_tokenURI', 'type': 'string'}], 'name': 'mint', 'outputs': [{'name': 'tokenId', 'type': 'uint256'}], 'payable': False, 'stateMutability': 'nonpayable', 'type': 'function'}, {'constant': False, 'inputs': [{'name': '_to', 'type': 'address'}, {'name': '_tokenId', 'type': 'uint256'}, {'name': '_numClonesRequested', 'type': 'uint256'}], 'name': 'clone', 'outputs': [], 'payable': True, 'stateMutability': 'payable', 'type': 'function'}, {'constant': False, 'inputs': [{'name': '_owner', 'type': 'address'}, {'name': '_tokenId', 'type': 'uint256'}], 'name': 'burn', 'outputs': [], 'payable': False, 'stateMutability': 'nonpayable', 'type': 'function'}, {'constant': False, 'inputs': [{'name': '_cloneFeePercentage', 'type': 'uint256'}], 'name': 'setCloneFeePercentage', 'outputs': [], 'payable': False, 'stateMutability': 'nonpayable', 'type': 'function'}, {'constant': False, 'inputs': [{'name': '_isMintable', 'type': 'bool'}], 'name': 'setMintable', 'outputs': [], 'payable': False, 'stateMutability': 'nonpayable', 'type': 'function'}, {'constant': False, 'inputs': [{'name': '_tokenId', 'type': 'uint256'}, {'name': '_newPriceFinney', 'type': 'uint256'}], 'name': 'setPrice', 'outputs': [], 'payable': False, 'stateMutability': 'nonpayable', 'type': 'function'}, {'constant': True, 'inputs': [{'name': '_tokenId', 'type': 'uint256'}], 'name': 'getKudosById', 'outputs': [{'name': 'priceFinney', 'type': 'uint256'}, {'name': 'numClonesAllowed', 'type': 'uint256'}, {'name': 'numClonesInWild', 'type': 'uint256'}, {'name': 'clonedFromId', 'type': 'uint256'}], 'payable': False, 'stateMutability': 'view', 'type': 'function'}, {'constant': True, 'inputs': [{'name': '_tokenId', 'type': 'uint256'}], 'name': 'getNumClonesInWild', 'outputs': [{'name': 'numClonesInWild', 'type': 'uint256'}], 'payable': False, 'stateMutability': 'view', 'type': 'function'}, {'constant': True, 'inputs': [], 'name': 'getLatestId', 'outputs': [{'name': 'tokenId', 'type': 'uint256'}], 'payable': False, 'stateMutability': 'view', 'type': 'function'}]
diff --git a/app/kudos/views.py b/app/kudos/views.py
index bd65430620c..957577d844d 100644
--- a/app/kudos/views.py
+++ b/app/kudos/views.py
@@ -28,7 +28,6 @@
from django.conf import settings
from django.contrib import messages
from django.contrib.staticfiles.templatetags.staticfiles import static
-from django.core.exceptions import PermissionDenied
from django.db import transaction
from django.db.models import Q
from django.http import Http404, HttpResponse, JsonResponse
@@ -43,10 +42,10 @@
from dashboard.models import Activity, Profile, SearchHistory
from dashboard.notifications import maybe_market_kudos_to_email, maybe_market_kudos_to_github
from dashboard.tasks import increment_view_count
-from dashboard.utils import get_nonce, get_web3, is_valid_eth_address
+from dashboard.utils import get_web3, is_valid_eth_address
from dashboard.views import record_user_action
from gas.utils import recommend_min_gas_price_to_confirm_in_time
-from git.utils import get_emails_by_category, get_emails_master, get_github_primary_email
+from git.utils import get_emails_by_category, get_github_primary_email
from kudos.tasks import redeem_bulk_kudos
from kudos.utils import kudos_abi
from marketing.mails import new_kudos_request
@@ -276,39 +275,6 @@ def mint(request):
return TemplateResponse(request, 'kudos_mint.html', {})
-def get_primary_from_email(params, request):
- """Find the primary_from_email address. This function finds the address using this priority:
-
- 1. If the email field is filed out in the Send POST request, use the `fromEmail` field.
- 2. If the user is logged in, they should have an email address associated with their account.
- Use this as the second option. `request_user_email`.
- 3. If all else fails, attempt to pull the email from the user's github account.
-
- Args:
- params (dict): A dictionary parsed form the POST request. Typically this is a POST
- request coming in from a Tips/Kudos send.
-
- Returns:
- str: The primary_from_email string.
-
- """
-
- request_user_email = request.user.email if request.user.is_authenticated else ''
- logger.info(request.user.profile)
- access_token = request.user.profile.get_access_token() if request.user.is_authenticated else ''
-
- if params.get('fromEmail'):
- primary_from_email = params['fromEmail']
- elif request_user_email:
- primary_from_email = request_user_email
- elif access_token:
- primary_from_email = get_github_primary_email(access_token)
- else:
- primary_from_email = 'unknown@gitcoin.co'
-
- return primary_from_email
-
-
def kudos_preferred_wallet(request, handle):
"""Returns the address, if any, that someone would like to be send kudos directly to."""
response = {'addresses': []}
diff --git a/app/marketing/apps.py b/app/marketing/apps.py
index d9fcfd91708..4ca569bd2db 100644
--- a/app/marketing/apps.py
+++ b/app/marketing/apps.py
@@ -22,8 +22,4 @@
class MarketingConfig(AppConfig):
-
name = 'marketing'
-
- def ready(self):
- from .signals import create_email_subscriber
diff --git a/app/marketing/mails.py b/app/marketing/mails.py
index 501cd77203a..a0b4006993b 100644
--- a/app/marketing/mails.py
+++ b/app/marketing/mails.py
@@ -22,14 +22,12 @@
import logging
from django.conf import settings
-from django.http import Http404, HttpResponse
from django.utils import timezone, translation
from django.utils.translation import gettext
from django.utils.translation import gettext_lazy as _
import sendgrid
from app.utils import get_profiles_from_text
-from grants.models import Subscription
from marketing.utils import func_name, get_or_save_email_subscriber, should_suppress_notification_email
from python_http_client.exceptions import HTTPError, UnauthorizedError
from retail.emails import (
@@ -41,13 +39,13 @@
render_grant_txn_failed, render_grant_update, render_match_distribution, render_match_email, render_mention,
render_new_bounty, render_new_bounty_acceptance, render_new_bounty_rejection, render_new_bounty_roundup,
render_new_contributions_email, render_new_grant_approved_email, render_new_grant_email, render_new_work_submission,
- render_no_applicant_reminder, render_nth_day_email_campaign, render_pending_contribution_email,
- render_quarterly_stats, render_remember_your_cart, render_request_amount_email, render_reserved_issue,
- render_start_work_applicant_about_to_expire, render_start_work_applicant_expired, render_start_work_approved,
- render_start_work_new_applicant, render_start_work_rejected, render_subscription_terminated_email,
- render_successful_contribution_email, render_support_cancellation_email, render_tax_report,
- render_thank_you_for_supporting_email, render_tip_email, render_tribe_hackathon_prizes,
- render_unread_notification_email_weekly_roundup, render_wallpost, render_weekly_recap,
+ render_no_applicant_reminder, render_pending_contribution_email, render_quarterly_stats, render_remember_your_cart,
+ render_request_amount_email, render_reserved_issue, render_start_work_applicant_about_to_expire,
+ render_start_work_applicant_expired, render_start_work_approved, render_start_work_new_applicant,
+ render_start_work_rejected, render_subscription_terminated_email, render_successful_contribution_email,
+ render_support_cancellation_email, render_tax_report, render_thank_you_for_supporting_email, render_tip_email,
+ render_tribe_hackathon_prizes, render_unread_notification_email_weekly_roundup, render_wallpost,
+ render_weekly_recap,
)
from sendgrid.helpers.mail import Attachment, Content, Email, Mail, Personalization
from sendgrid.helpers.stats import Category
@@ -176,26 +174,6 @@ def get_bounties_for_keywords(keywords, hours_back):
return new_bounties, all_bounties
-def nth_day_email_campaign(nth, subscriber):
- firstname = subscriber.email.split('@')[0]
-
- if subscriber.profile and subscriber.profile.user and subscriber.profile.user.first_name:
- firstname = subscriber.profile.user.first_name
-
- if should_suppress_notification_email(subscriber.email, 'roundup'):
- return False
- cur_language = translation.get_language()
-
- try:
- setup_lang(subscriber.email)
- from_email = settings.CONTACT_EMAIL
- if not should_suppress_notification_email(subscriber.email, 'welcome_mail'):
- html, text, subject = render_nth_day_email_campaign(subscriber.email, nth, firstname)
- to_email = subscriber.email
- send_mail(from_email, to_email, subject, text, html, categories=['transactional', func_name()])
- finally:
- translation.activate(cur_language)
-
def featured_funded_bounty(from_email, bounty):
to_email = bounty.bounty_owner_email
@@ -284,24 +262,6 @@ def new_grant_approved(grant, profile):
translation.activate(cur_language)
-def new_grant_match_pledge(matchpledge):
- to_email = 'founders@gitcoin.co'
- from_email = matchpledge.profile.email
- cur_language = translation.get_language()
-
- try:
- setup_lang(to_email)
- subject = f"New Grants Match Pledge Inquiry from {matchpledge.profile.handle}"
- body = f""
- for key, val in matchpledge.data_json.items():
- body += f"{key}: {val}\n"
- body += f"\n\n\n{settings.BASE_URL}{matchpledge.admin_url}"
- html = f"
"
- if not should_suppress_notification_email(to_email, 'admin'):
- send_mail(
- from_email,
- to_email,
- subject,
- body,
- from_name=_("No Reply from Gitcoin.co"),
- categories=['admin', func_name()],
- )
- finally:
- translation.activate(cur_language)
-
-
def new_feedback(email, feedback):
to_email = 'product@gitcoin.co'
from_email = settings.SERVER_EMAIL
diff --git a/app/marketing/management/commands/assemble_leaderboards.py b/app/marketing/management/commands/assemble_leaderboards.py
index 53ad6f03304..6456e1a0981 100644
--- a/app/marketing/management/commands/assemble_leaderboards.py
+++ b/app/marketing/management/commands/assemble_leaderboards.py
@@ -21,11 +21,9 @@
from django.contrib.contenttypes.models import ContentType
from django.core.management.base import BaseCommand
from django.db import connection, transaction
-from django.db.models import Q
from django.utils import timezone
-from cacheops import CacheMiss, cache
-from dashboard.models import Earning, Profile
+from dashboard.models import Profile
from marketing.models import LeaderboardRank
# Constants
diff --git a/app/marketing/management/commands/campaign_email.py b/app/marketing/management/commands/campaign_email.py
index a0a4d4b2d8b..0f6e4e51390 100644
--- a/app/marketing/management/commands/campaign_email.py
+++ b/app/marketing/management/commands/campaign_email.py
@@ -21,7 +21,6 @@
from django.core.management.base import BaseCommand
from django.utils import timezone
-from marketing.mails import nth_day_email_campaign
from marketing.models import EmailSubscriber
@@ -33,14 +32,6 @@ def n_days_ago(n):
tzinfo=timezone.get_current_timezone())
-def send_nth_email_to_subscriber(nth, sub):
- first_email = EmailSubscriber.objects.filter(email__iexact=sub.email).order_by('created_on').first()
- if first_email.id == sub.id:
- # it is the first time this subscriber is in our system
- # send email to him/her
- nth_day_email_campaign(nth, sub)
-
-
def send_nth_email(nth):
print('sending day {} email'.format(nth))
# query all new subscribers created
diff --git a/app/marketing/management/commands/expiration_start_work.py b/app/marketing/management/commands/expiration_start_work.py
index 74798309143..bfd4a3eb476 100644
--- a/app/marketing/management/commands/expiration_start_work.py
+++ b/app/marketing/management/commands/expiration_start_work.py
@@ -26,7 +26,7 @@
from django.utils import timezone
import pytz
-from dashboard.models import Bounty, Interest, UserAction
+from dashboard.models import Bounty, Interest
from dashboard.notifications import (
maybe_notify_bounty_user_escalated_to_slack, maybe_notify_bounty_user_warned_removed_to_slack,
maybe_notify_user_escalated_github, maybe_warn_user_removed_github,
diff --git a/app/marketing/management/commands/export_graph_edges.py b/app/marketing/management/commands/export_graph_edges.py
index f3acce16a9a..f75bafa580f 100644
--- a/app/marketing/management/commands/export_graph_edges.py
+++ b/app/marketing/management/commands/export_graph_edges.py
@@ -17,7 +17,6 @@
'''
import re
-from django.conf import settings
from django.core.management.base import BaseCommand
from django.utils import timezone
diff --git a/app/marketing/management/commands/ingest_community_events_calender.py b/app/marketing/management/commands/ingest_community_events_calender.py
index e5de9e880cf..13dd4fe3b6c 100644
--- a/app/marketing/management/commands/ingest_community_events_calender.py
+++ b/app/marketing/management/commands/ingest_community_events_calender.py
@@ -15,14 +15,10 @@
along with this program. If not, see .
'''
-import time
-
from django.core.management.base import BaseCommand
-from django.db.models import Q
-from django.utils import timezone
import requests
-from icalendar import Calendar, Event
+from icalendar import Calendar
from marketing.models import UpcomingDate
# The iCal link for Gitcoin community events calender
diff --git a/app/marketing/management/commands/make_everyone_avatars.py b/app/marketing/management/commands/make_everyone_avatars.py
index 526351d5e86..6f542947a5c 100644
--- a/app/marketing/management/commands/make_everyone_avatars.py
+++ b/app/marketing/management/commands/make_everyone_avatars.py
@@ -15,7 +15,6 @@
along with this program. If not, see .
'''
-from django.conf import settings
from django.core.management.base import BaseCommand
diff --git a/app/marketing/management/commands/make_request_coins.py b/app/marketing/management/commands/make_request_coins.py
index e97abc4ed69..c6be5719aa9 100644
--- a/app/marketing/management/commands/make_request_coins.py
+++ b/app/marketing/management/commands/make_request_coins.py
@@ -17,10 +17,6 @@
along with this program. If not, see .
"""
-import time
-import warnings
-from datetime import datetime
-
from django.core.management.base import BaseCommand
from django.utils.crypto import get_random_string
diff --git a/app/marketing/management/commands/new_bounties_email.py b/app/marketing/management/commands/new_bounties_email.py
index 8f41abbe16a..afe98e14d95 100644
--- a/app/marketing/management/commands/new_bounties_email.py
+++ b/app/marketing/management/commands/new_bounties_email.py
@@ -21,12 +21,9 @@
from django.conf import settings
from django.core.management.base import BaseCommand
-from django.utils import timezone
from marketing.models import EmailSubscriber
from marketing.tasks import new_bounty_daily
-from marketing.utils import should_suppress_notification_email
-from townsquare.utils import is_email_townsquare_enabled
warnings.filterwarnings("ignore")
diff --git a/app/marketing/management/commands/post_data.py b/app/marketing/management/commands/post_data.py
index 5b657f90e03..b1bef4ee292 100644
--- a/app/marketing/management/commands/post_data.py
+++ b/app/marketing/management/commands/post_data.py
@@ -19,7 +19,6 @@
"""
import operator
import random
-import time
import warnings
from datetime import datetime
diff --git a/app/marketing/management/commands/prune_bad_activities.py b/app/marketing/management/commands/prune_bad_activities.py
index a9e2b0196fc..8ad717b16e8 100644
--- a/app/marketing/management/commands/prune_bad_activities.py
+++ b/app/marketing/management/commands/prune_bad_activities.py
@@ -11,8 +11,6 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
'''
-import time
-
from django.core.management.base import BaseCommand
from django.utils import timezone
diff --git a/app/marketing/management/commands/pull_github.py b/app/marketing/management/commands/pull_github.py
index b02a7e6eac5..f8a6366515a 100644
--- a/app/marketing/management/commands/pull_github.py
+++ b/app/marketing/management/commands/pull_github.py
@@ -22,7 +22,7 @@
from dashboard.models import Profile
from dashboard.utils import ProfileHiddenException, ProfileNotFoundException, profile_helper
-from git.utils import search
+from git.utils import search_user
from marketing.models import EmailSubscriber
@@ -30,15 +30,6 @@ class NoUsersException(Exception):
pass
-def get_github_user_from_github(email):
- result = search(email)
- if not result.get('total_count', 0):
- # print(result)
- raise NoUsersException("no users found")
-
- return result['items'][0]
-
-
def get_github_user_from_DB(email):
users = User.objects.filter(email__iexact=email)
for user in users:
@@ -68,8 +59,8 @@ def handle(self, *args, **options):
if not es.github:
es.github = get_github_user_from_DB(es.email)
if not es.github:
- ghuser = get_github_user_from_github(es.email)
- es.github = ghuser['login']
+ ghuser = search_user(es.email)
+ es.github = ghuser.login
if not es.keywords:
try:
es.profile = profile_helper(es.github, True)
diff --git a/app/marketing/management/commands/send_quarterly_stats.py b/app/marketing/management/commands/send_quarterly_stats.py
index c96764289d8..d9ab1253f7d 100644
--- a/app/marketing/management/commands/send_quarterly_stats.py
+++ b/app/marketing/management/commands/send_quarterly_stats.py
@@ -22,7 +22,7 @@
from dashboard.models import Profile
from marketing.mails import quarterly_stats
-from marketing.models import EmailSubscriber, LeaderboardRank
+from marketing.models import LeaderboardRank
from marketing.utils import get_platform_wide_stats
warnings.filterwarnings("ignore", category=DeprecationWarning)
diff --git a/app/marketing/management/commands/send_tax_report.py b/app/marketing/management/commands/send_tax_report.py
index a2f0cdbb57d..9ab004c6a28 100644
--- a/app/marketing/management/commands/send_tax_report.py
+++ b/app/marketing/management/commands/send_tax_report.py
@@ -19,7 +19,6 @@
import json
import logging
import os
-import shutil
import warnings
import zipfile
@@ -29,13 +28,9 @@
from django.db.models import F
import pdfrw
-import sendgrid
from dashboard.models import Bounty, BountyFulfillment, Earning, Profile, Tip
from grants.models import Grant
from marketing.mails import tax_report
-from python_http_client.exceptions import HTTPError, UnauthorizedError
-from sendgrid.helpers.mail import Content, Email, Mail, Personalization
-from sendgrid.helpers.stats import Category
logger = logging.getLogger(__name__)
diff --git a/app/marketing/management/commands/sync_github.py b/app/marketing/management/commands/sync_github.py
index c7fa868307e..440184c6ec4 100644
--- a/app/marketing/management/commands/sync_github.py
+++ b/app/marketing/management/commands/sync_github.py
@@ -55,7 +55,7 @@ def all_bountied_repos(self):
def do_we_care(self, event):
repos_we_care_about = self.all_bountied_repos()
try:
- repo_name = event.get('repo', {}).get('name', '').lower()
+ repo_name = event.repo.name.lower()
return repo_name in repos_we_care_about
except AttributeError:
logger.debug('Error in do_we_care during sync_github')
@@ -74,20 +74,15 @@ def sync_profile_actions(self):
# process them
for profile in profiles:
try:
- events = get_user(profile.handle, '/events')
+ events = get_user(profile.handle).get_events()
for event in events:
- try:
- event_time = event.get('created_at', False)
- created_on = datetime.datetime.strptime(event_time, '%Y-%m-%dT%H:%M:%SZ')
- except Exception:
- created_on = timezone.now()
if self.do_we_care(event):
GithubEvent.objects.get_or_create(
profile=profile,
- payload=event,
- what=event.get('type', ''),
- repo=event.get('repo', {}).get('name', ''),
- created_on=created_on,
+ payload=event._rawData,
+ what=event.type,
+ repo=event.repo.name,
+ created_on=event.created_at,
)
except Exception as e:
logger.error('Error while syncing profile actions during sync_github', e)
diff --git a/app/marketing/management/commands/sync_pull_request_with_bounty_fulfillments.py b/app/marketing/management/commands/sync_pull_request_with_bounty_fulfillments.py
index 8f79ec30750..52de567c0ed 100644
--- a/app/marketing/management/commands/sync_pull_request_with_bounty_fulfillments.py
+++ b/app/marketing/management/commands/sync_pull_request_with_bounty_fulfillments.py
@@ -23,7 +23,7 @@
from dashboard.models import BountyFulfillment
from dashboard.utils import record_funder_inaction_on_fulfillment
-from git.utils import get_gh_issue_state, get_interested_actions, post_issue_comment
+from git.utils import get_interested_actions, get_issue_state, post_issue_comment
from marketing.mails import funder_payout_reminder
logger = logging.getLogger('')
@@ -54,7 +54,7 @@ def _get_time_window(self, timestamp, settings):
def _check_if_bounty_is_closed(self, bounty):
try:
- closed_issue = get_gh_issue_state(
+ closed_issue = get_issue_state(
bounty.github_org_name, bounty.github_repo_name, bounty.github_issue_number
)
except Exception as e:
diff --git a/app/marketing/management/commands/tribe_hackathon_prizes_email.py b/app/marketing/management/commands/tribe_hackathon_prizes_email.py
index 258b4a83d28..6be461eca60 100644
--- a/app/marketing/management/commands/tribe_hackathon_prizes_email.py
+++ b/app/marketing/management/commands/tribe_hackathon_prizes_email.py
@@ -11,8 +11,6 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
'''
-import datetime
-
from django.conf import settings
from django.core.management.base import BaseCommand
from django.utils import timezone
diff --git a/app/marketing/management/commands/unsubscribe_daily_emails.py b/app/marketing/management/commands/unsubscribe_daily_emails.py
index 0379251bfa7..fe7c81cea58 100644
--- a/app/marketing/management/commands/unsubscribe_daily_emails.py
+++ b/app/marketing/management/commands/unsubscribe_daily_emails.py
@@ -17,7 +17,6 @@
along with this program. If not, see .
"""
-import time
import warnings
from django.conf import settings
diff --git a/app/marketing/signals.py b/app/marketing/signals.py
deleted file mode 100644
index 5fd87c8c693..00000000000
--- a/app/marketing/signals.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# -*- coding: utf-8 -*-
-'''
- Copyright (C) 2021 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 django.db.models.signals import post_save
-# from django.dispatch import receiver
-
-# from marketing.mails import nth_day_email_campaign
-# from marketing.models import EmailSubscriber
-
-
-# @receiver(post_save, sender=EmailSubscriber) - PURGED
-# def create_email_subscriber(sender, instance, created, **kwargs):
-# if created:
-# if not EmailSubscriber.objects.filter(email=instance.email).exclude(id=instance.id).exists():
-# # this subscriber is the first time shown in our db
-# # send email
-# nth_day_email_campaign(1, instance)
diff --git a/app/marketing/stats.py b/app/marketing/stats.py
index beb4d39523f..42eb5ef7564 100644
--- a/app/marketing/stats.py
+++ b/app/marketing/stats.py
@@ -16,15 +16,12 @@
along with this program. If not, see .
'''
-import logging
-from datetime import datetime, timedelta
from django.conf import settings
from django.utils import timezone
from marketing.models import Stat
from slackclient import SlackClient
-from slackclient.exceptions import SlackClientError
def gitter():
@@ -142,20 +139,20 @@ def user_actions():
def github_stars():
from git.utils import get_user
- reops = get_user('gitcoinco', '/repos')
- forks_count = sum([repo['forks_count'] for repo in reops])
+ repos = get_user('gitcoinco').get_repos()
+ forks_count = sum([repo.forks_count for repo in repos])
Stat.objects.create(
key='github_forks_count',
val=forks_count,
- )
+ )
- stargazers_count = sum([repo['stargazers_count'] for repo in reops])
+ stargazers_count = sum([repo.stargazers_count for repo in repos])
Stat.objects.create(
key='github_stargazers_count',
val=stargazers_count,
- )
+ )
def github_issues():
@@ -165,8 +162,8 @@ def github_issues():
repos = []
for org in ['bitcoin', 'gitcoinco', 'ethereum']:
- for repo in get_user(org, '/repos'):
- repos.append((org, repo['name']))
+ for repo in get_user(org).get_repos():
+ repos.append((org, repo.name))
for org, repo in repos:
issues = []
@@ -185,7 +182,7 @@ def github_issues():
created_on=timezone.now(),
key=key,
val=(val),
- )
+ )
except Exception:
pass
if not val:
diff --git a/app/marketing/tasks.py b/app/marketing/tasks.py
index 923d560432a..a28e350f8c1 100644
--- a/app/marketing/tasks.py
+++ b/app/marketing/tasks.py
@@ -1,8 +1,7 @@
from django.conf import settings
-from django.contrib.contenttypes.models import ContentType
from app.services import RedisService
-from celery import app, group
+from celery import app
from celery.utils.log import get_task_logger
from marketing.mails import new_bounty_daily as new_bounty_daily_email
from marketing.mails import weekly_roundup as weekly_roundup_email
diff --git a/app/marketing/tests/management/commands/test_assemble_leaderboards.py b/app/marketing/tests/management/commands/test_assemble_leaderboards.py
index 6b0d810ec1e..6ae20da385a 100644
--- a/app/marketing/tests/management/commands/test_assemble_leaderboards.py
+++ b/app/marketing/tests/management/commands/test_assemble_leaderboards.py
@@ -17,17 +17,15 @@
along with this program. If not, see .
"""
-from datetime import date, datetime, timedelta
+from datetime import datetime, timedelta
from unittest.mock import patch
from django.contrib.contenttypes.models import ContentType
from django.utils import timezone
-import pytest
-from dashboard.models import Activity, Bounty, BountyFulfillment, Earning, Profile, Tip, UserAction
-from marketing.management.commands import assemble_leaderboards
+from dashboard.models import Bounty, BountyFulfillment, Earning, Profile, Tip, UserAction
from marketing.management.commands.assemble_leaderboards import (
- BREAKDOWNS, do_leaderboard, run_monthly, run_quarterly, run_weekly, run_yearly, should_suppress_leaderboard,
+ do_leaderboard, run_monthly, run_quarterly, run_weekly, run_yearly, should_suppress_leaderboard,
)
from marketing.models import LeaderboardRank
from pytz import UTC
diff --git a/app/marketing/tests/management/commands/test_ingest_community_events_calender.py b/app/marketing/tests/management/commands/test_ingest_community_events_calender.py
index 138a067de45..be536a6714c 100644
--- a/app/marketing/tests/management/commands/test_ingest_community_events_calender.py
+++ b/app/marketing/tests/management/commands/test_ingest_community_events_calender.py
@@ -18,13 +18,9 @@
"""
import os
-from datetime import datetime, timedelta
from unittest import mock
-from unittest.mock import patch
-from django.utils import timezone
-
-from icalendar import Calendar, Event
+from icalendar import Calendar
from marketing.management.commands.ingest_community_events_calender import Command
from marketing.models import UpcomingDate
from test_plus.test import TestCase
diff --git a/app/marketing/tests/management/commands/test_new_bounties_email.py b/app/marketing/tests/management/commands/test_new_bounties_email.py
index 845db3c1b97..f937aa036d0 100644
--- a/app/marketing/tests/management/commands/test_new_bounties_email.py
+++ b/app/marketing/tests/management/commands/test_new_bounties_email.py
@@ -1,12 +1,10 @@
-from datetime import datetime, timedelta
+from datetime import timedelta
-from django.core.management import call_command
from django.utils import timezone
import pytest
from dashboard.models import Bounty, Profile
from marketing.mails import get_bounties_for_keywords
-from marketing.models import Keyword
from test_plus.test import TestCase
diff --git a/app/marketing/tests/management/commands/test_sync_pull_request_with_bounty_fulfillments.py b/app/marketing/tests/management/commands/test_sync_pull_request_with_bounty_fulfillments.py
index d5c0795edf7..5cb64fabd55 100644
--- a/app/marketing/tests/management/commands/test_sync_pull_request_with_bounty_fulfillments.py
+++ b/app/marketing/tests/management/commands/test_sync_pull_request_with_bounty_fulfillments.py
@@ -19,10 +19,9 @@
"""
import json
import os
-from datetime import datetime, timedelta
+from datetime import timedelta
from unittest import mock
-from django.conf import settings
from django.utils import timezone
import marketing
@@ -80,7 +79,7 @@ def setUp(self):
def test_handle_simple(self, mocked_requests):
"""Test command sync keywords."""
start_time = timezone.now()
- mock.patch('marketing.management.commands.sync_pull_request_with_bounty_fulfillments.get_gh_issue_state', lambda x, y, z: 'closed').start()
+ mock.patch('marketing.management.commands.sync_pull_request_with_bounty_fulfillments.get_issue_state', lambda x, y, z: 'closed').start()
mock.patch('marketing.management.commands.sync_pull_request_with_bounty_fulfillments.get_interested_actions', lambda x, y: GitHubTestAPI().get_interested_actions()).start()
marketing.management.commands.sync_pull_request_with_bounty_fulfillments.Command().handle(live=False)
diff --git a/app/marketing/tests/test_mail_funder_payout_reminder.py b/app/marketing/tests/test_mail_funder_payout_reminder.py
index 912f895afcb..5425306dc5a 100644
--- a/app/marketing/tests/test_mail_funder_payout_reminder.py
+++ b/app/marketing/tests/test_mail_funder_payout_reminder.py
@@ -17,11 +17,9 @@
along with this program. If not, see .
"""
-import os
from datetime import timedelta
from unittest import mock
-from django.conf import settings
from django.utils import timezone
from dashboard.models import Bounty, BountyFulfillment, Profile
diff --git a/app/marketing/tests/test_mailchimp_sync.py b/app/marketing/tests/test_mailchimp_sync.py
index 89d178770b8..379039cb3db 100644
--- a/app/marketing/tests/test_mailchimp_sync.py
+++ b/app/marketing/tests/test_mailchimp_sync.py
@@ -25,7 +25,6 @@
from dashboard.models import Profile
from marketing.management.commands.sync_mail import push_to_mailchimp
from marketing.models import EmailSubscriber
-from retail.emails import render_nth_day_email_campaign
from test_plus.test import TestCase
diff --git a/app/marketing/tests/test_mails.py b/app/marketing/tests/test_mails.py
index 69d14b04dc4..4173a864721 100644
--- a/app/marketing/tests/test_mails.py
+++ b/app/marketing/tests/test_mails.py
@@ -22,8 +22,7 @@
from django.utils import timezone
from dashboard.models import Profile
-from marketing.mails import nth_day_email_campaign, setup_lang
-from retail.emails import render_nth_day_email_campaign
+from marketing.mails import setup_lang
from test_plus.test import TestCase
@@ -56,24 +55,3 @@ 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
-
- @patch('marketing.mails.send_mail')
- def test_day_1_campaign_email(self, mock_send_mail):
- """Test the campaign email for day 1 is sent."""
-
- nth_day_email_campaign(self.days[0], self.user)
- assert mock_send_mail.call_count == 1
-
- @patch('marketing.mails.send_mail')
- def test_day_2_campaign_email(self, mock_send_mail):
- """Test the campaign email for day 2 is sent."""
-
- nth_day_email_campaign(self.days[1], self.user)
- assert mock_send_mail.call_count == 1
-
- @patch('marketing.mails.send_mail')
- def test_day_3_campaign_email(self, mock_send_mail):
- """Test the campaign email for day 3 is sent."""
-
- nth_day_email_campaign(self.days[2], self.user)
- assert mock_send_mail.call_count == 1
diff --git a/app/marketing/utils.py b/app/marketing/utils.py
index 9bfa302d592..f4db3ac36eb 100644
--- a/app/marketing/utils.py
+++ b/app/marketing/utils.py
@@ -36,42 +36,6 @@
logger = logging.getLogger(__name__)
-def delete_user_from_mailchimp(email_address):
- client = MailChimp(mc_user=settings.MAILCHIMP_USER, mc_api=settings.MAILCHIMP_API_KEY)
- result = None
- try:
- result = client.search_members.get(query=email_address)
- if result:
- subscriber_hash = result.get('exact_matches', {}).get('members', [{}])[0].get('id', None)
- except Exception as e:
- logger.debug(e)
-
-
- try:
- client.lists.members.delete(
- list_id=settings.MAILCHIMP_LIST_ID,
- subscriber_hash=subscriber_hash,
- )
- except Exception as e:
- logger.debug(e)
-
- try:
- client.lists.members.delete(
- list_id=settings.MAILCHIMP_LIST_ID_HUNTERS,
- subscriber_hash=subscriber_hash,
- )
- except Exception as e:
- logger.debug(e)
-
- try:
- client.lists.members.delete(
- list_id=settings.MAILCHIMP_LIST_ID_HUNTERS,
- subscriber_hash=subscriber_hash,
- )
- except Exception as e:
- logger.debug(e)
-
-
def is_deleted_account(handle):
return AccountDeletionRequest.objects.filter(handle=handle.lower()).exists()
@@ -149,52 +113,6 @@ def validate_slack_integration(token, channel, message=None, icon_url=''):
return result
-def validate_discord_integration(webhook_url, message=None, icon_url=''):
- """Validate the Discord webhook URL by posting a message.
-
- Args:
- webhook_url (str): The Discord webhook URL.
- message (str): The Discord message to be sent.
- Defaults to: The Gitcoin Discord integration is working fine.
- icon_url (str): The URL to the avatar to be used.
- Defaults to: the gitcoin helmet.
-
- Attributes:
- result (dict): The result dictionary defining success status and error message.
- message (str): The response message to display to the user.
- response (obj): The Discord response object - refer to python-requests API
-
- Raises:
- requests.exception.HTTPError: The exception is raised for any HTTP error.
-
- Returns:
- str: The response message.
-
- """
- result = {'success': False, 'output': 'Test message was not sent.'}
-
- if message is None:
- message = gettext('The Gitcoin Discord integration is working fine.')
-
- if not icon_url:
- icon_url = static('v2/images/helmet.png')
-
- try:
- headers = {'Content-Type': 'application/json'}
- body = {"content": message, "avatar_url": icon_url}
- response = requests.post(
- webhook_url, headers=headers, json=body
- )
- response.raise_for_status()
- if response.ok:
- result['output'] = _('The test message was sent to Discord.')
- result['success'] = True
- except requests.exceptions.HTTPError as e:
- logger.error(e)
- result['output'] = _('An error has occurred.')
- return result
-
-
def should_suppress_notification_email(email, email_type):
from marketing.models import EmailSubscriber
queryset = EmailSubscriber.objects.filter(email__iexact=email)
diff --git a/app/marketing/views.py b/app/marketing/views.py
index 71717294e48..e62452184ea 100644
--- a/app/marketing/views.py
+++ b/app/marketing/views.py
@@ -29,19 +29,17 @@
from django.contrib.auth import logout
from django.contrib.auth.models import User
from django.core.validators import validate_email
-from django.db.models import Avg, Count, Max, Q
+from django.db.models import Avg, Max
from django.http import Http404, HttpResponse
from django.shortcuts import redirect
from django.template.response import TemplateResponse
from django.urls import reverse
-from django.utils import timezone, translation
-from django.utils.translation import LANGUAGE_SESSION_KEY
+from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from app.utils import sync_profile
-from cacheops import cached_view
from chartit import PivotChart, PivotDataPool
-from dashboard.models import Activity, HackathonEvent, Profile, TokenApproval
+from dashboard.models import HackathonEvent, Profile, TokenApproval
from dashboard.utils import create_user_action, get_orgs_perms, is_valid_eth_address
from dashboard.views import mautic_proxy_backend
from gas.utils import recommend_min_gas_price_to_confirm_in_time
@@ -51,8 +49,7 @@
from marketing.mails import new_feedback
from marketing.models import AccountDeletionRequest, EmailSubscriber, Keyword, LeaderboardRank, UpcomingDate
from marketing.utils import get_or_save_email_subscriber, validate_slack_integration
-from quests.models import Quest
-from retail.emails import ALL_EMAILS, render_new_bounty, render_nth_day_email_campaign
+from retail.emails import render_new_bounty
from retail.helpers import get_ip
from townsquare.models import Announcement
@@ -982,12 +979,6 @@ def leaderboard(request, key=''):
return TemplateResponse(request, 'leaderboard.html', context)
-@staff_member_required
-def day_email_campaign(request, day):
- if day not in list(range(1, 3)):
- raise Http404
- response_html, _, _, = render_nth_day_email_campaign('foo@bar.com', day, 'staff member')
- return HttpResponse(response_html)
def trending_quests():
from quests.models import QuestAttempt
@@ -1019,15 +1010,6 @@ def upcoming_grant():
grant = Grant.objects.order_by('-weighted_shuffle').first()
return grant
-def upcoming_hackathon():
- try:
- return HackathonEvent.objects.filter(end_date__gt=timezone.now(), visible=True).order_by('-start_date')
- except HackathonEvent.DoesNotExist:
- try:
- return [HackathonEvent.objects.filter(start_date__gte=timezone.now(), visible=True).order_by('start_date').first()]
- except HackathonEvent.DoesNotExist:
- return None
-
def get_hackathons():
from perftools.models import JSONStore
from dateutil.parser import parse
diff --git a/app/passport/views.py b/app/passport/views.py
index efd2c7b23d6..22fd07955da 100644
--- a/app/passport/views.py
+++ b/app/passport/views.py
@@ -2,10 +2,8 @@
import uuid
from django.conf import settings
-from django.http import Http404, JsonResponse
-from django.shortcuts import render
+from django.http import JsonResponse
-import web3
from dashboard.utils import get_web3
from eth_account.messages import defunct_hash_message
diff --git a/app/perftools/management/commands/create_activity_cache.py b/app/perftools/management/commands/create_activity_cache.py
index 220ad4557a7..cbdcd4ae0df 100644
--- a/app/perftools/management/commands/create_activity_cache.py
+++ b/app/perftools/management/commands/create_activity_cache.py
@@ -17,9 +17,8 @@
'''
from django.core.management.base import BaseCommand
-from django.utils import timezone
-from dashboard.models import Activity, HackathonEvent
+from dashboard.models import HackathonEvent
from perftools.models import JSONStore
diff --git a/app/perftools/management/commands/create_page_cache.py b/app/perftools/management/commands/create_page_cache.py
index 408cb6864de..43dc426e9d8 100644
--- a/app/perftools/management/commands/create_page_cache.py
+++ b/app/perftools/management/commands/create_page_cache.py
@@ -21,7 +21,6 @@
from django.conf import settings
from django.core.management.base import BaseCommand
-from django.core.serializers.json import DjangoJSONEncoder
from django.db import transaction
from django.utils import timezone
@@ -31,7 +30,7 @@
from dashboard.utils import set_hackathon_event
from economy.models import EncodeAnything
from grants.models import Contribution, Grant, GrantCategory, GrantType
-from grants.utils import generate_grants_leaderboard, get_clr_rounds_metadata
+from grants.utils import get_clr_rounds_metadata
from marketing.models import Stat
from perftools.models import JSONStore
from quests.helpers import generate_leaderboard
@@ -262,17 +261,6 @@ def create_activity_cache():
data=json.loads(json.dumps(data, cls=EncodeAnything)),
)
-def create_grants_cache():
- print('grants')
- view = 'grants'
- keyword = 'leaderboard'
- data = generate_grants_leaderboard()
- JSONStore.objects.create(
- view=view,
- key=keyword,
- data=json.loads(json.dumps(data, cls=EncodeAnything)),
- )
-
def create_quests_cache():
@@ -402,7 +390,6 @@ def handle(self, *args, **options):
operations.append(create_top_grant_spenders_cache)
operations.append(create_avatar_cache)
operations.append(create_quests_cache)
- operations.append(create_grants_cache)
operations.append(create_contributor_landing_page_context)
operations.append(create_hackathon_cache)
operations.append(create_hackathon_list_page_cache)
diff --git a/app/perftools/views.py b/app/perftools/views.py
index 6d860554567..d689289f85e 100644
--- a/app/perftools/views.py
+++ b/app/perftools/views.py
@@ -2,7 +2,6 @@
from django.conf import settings
from django.http import HttpResponse
-from django.shortcuts import render
from django.views.decorators.cache import cache_page
from django.views.decorators.csrf import csrf_exempt
diff --git a/app/ptokens/helpers.py b/app/ptokens/helpers.py
index 9f12b827331..a6b516ea0c8 100644
--- a/app/ptokens/helpers.py
+++ b/app/ptokens/helpers.py
@@ -1,4 +1,4 @@
-from datetime import datetime, timezone
+from datetime import datetime
from dashboard.models import Activity
diff --git a/app/ptokens/templates/shared/ptokens_faq.html b/app/ptokens/templates/shared/ptokens_faq.html
deleted file mode 100644
index 401b8d530a1..00000000000
--- a/app/ptokens/templates/shared/ptokens_faq.html
+++ /dev/null
@@ -1,80 +0,0 @@
-{% comment %}
- Copyright (C) 2021 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 .
-{% endcomment %}
-{% load static humanize i18n bundle %}
-{% bundle css file kudos_styles %}
-
-{% endbundle %}
-
-
-
FAQ
-
-
-
-
-
- {% trans "What are time tokens?" %}
-
-
-
-
Time tokens are ERC20 tokens tied to different Gitcoin users. They represent a claim over listed uses like time, work and feedback. Each time token is unique, and different tokens may be redeemed for specific uses.
-
-
-
-
- Where do I see a user’s time token?
-
-
-
-
The best place to see a user’s token is directly on their Gitcoin Profile, under the Time Token tab at the top of the page. This shows you how much their tokens cost, and exactly what they can be used for.
-
-
-
-
- How do I use a time token?
-
-
-
-
- Once you’ve acquired a time token, you’ll need to submit a redemption request.
- This request can be used on any of the Creators listed uses, and only for those uses.
- Please note that it’s up to the creator to determine whether or not your request is appropriate, so please give them 24-48 hours to respond to your request.
-
-
-
-
-
- What happens to my time tokens when they are used?
-
-
-
-
When a Creator accepts your request, the equivalent amount of time tokens is automatically burned and removed from the supply forever.
-
-
-
-
- A Creator accepted my request and did not meet my expectations - What should I do?
-
-
-
-
Under each profile you’ll see a feedback score. This is the main place where we can see how a creator is holding up their end of the bargain. Please submit an appropriate overview on what happened and we’ll look to see if further action needs to be taken.
diff --git a/app/retail/templates/emails/bounty_small.html b/app/retail/templates/emails/bounty_small.html
deleted file mode 100644
index 1f05bac1002..00000000000
--- a/app/retail/templates/emails/bounty_small.html
+++ /dev/null
@@ -1,92 +0,0 @@
-{% comment %}
- Copyright (C) 2021 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 .
-
-{% endcomment %}
-{% load i18n humanize %}
-
-
-
-
- {% include 'emails/shared_bounty_actions.html' with action='custom' action_copy='View' action_url=bounty.absolute_url %}
-
-
-
-
-
-
diff --git a/app/retail/templates/emails/campaigns/email_campaign_day_1.html b/app/retail/templates/emails/campaigns/email_campaign_day_1.html
deleted file mode 100644
index e38f617fcdc..00000000000
--- a/app/retail/templates/emails/campaigns/email_campaign_day_1.html
+++ /dev/null
@@ -1,98 +0,0 @@
-{% extends 'emails/template.html' %}
-
-{% comment %}
- Copyright (C) 2021 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 .
-
-{% endcomment %}
-
-{% load i18n humanize %}
-
-{% block content %}
-
-
-
-
-
-
Day 1: Growing Open Source
-
-
-
- {% trans "Hi" %} {{ firstname }},
-
-
-
- {% blocktrans %}
- Welcome to Gitcoin! Our mission is to
- grow open source. Open source software is a force for good in the world, and we believe it’s the key to saving the internet. While a generation of software careers has been powered by open source software, it’s still hard to make a living working on open source. We plan to bring our mission to the Web 3.0 ecosystem.
- {% endblocktrans %}
-
-
-
- {% blocktrans %}
- The issue Explorer is our first tool towards this end. Use it to find paid issues to work on in open source. Help build projects, ship code, and get paid in crypto tokens. Give it a try and let us know what you think!
- {% endblocktrans %}
-
-
-
- {% blocktrans %}
- As time passes, we’ll send you more ways to get involved in Gitcoin. For now, we have a few areas you can nerd out with us, depending on where you’re most comfortable.
-
-
-{% endblock %}
diff --git a/app/retail/templates/emails/campaigns/email_campaign_day_1.txt b/app/retail/templates/emails/campaigns/email_campaign_day_1.txt
deleted file mode 100644
index b3b1b56a5ce..00000000000
--- a/app/retail/templates/emails/campaigns/email_campaign_day_1.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-Day 1: Growing Open Source
-
-
-Welcome to Gitcoin! Our mission is to grow open source. Open source software is a force for good in the world, and we believe it’s the key to saving the internet. While a generation of software careers has been powered by open source software, it’s still hard to make a living working on open source. We plan to bring our mission to the Web 3.0 ecosystem.
-
-The Issue Explorer is our first tool towards this end. Use it to find paid issues to work on in open source. Help build projects, ship code, and get paid in crypto tokens. Give it a try and let us know what you think!
-
-As time passes, we’ll send you more ways to get involved in Gitcoin. For now, we have a few areas you can nerd out with us, depending on where you’re most comfortable.
-
-Join the Slack channel and say hi on #community-intros!
-
-Follow us on Twitter for updates on open source software.
-
-Add the Gitcoin Livestream to your cal (iCal, Google) for Friday at 2PM EST. We’ll have two weekly product demos from the blockchain & open source ecosystems (like Decentraland or meta-transactions with Austin Griffith).
-
-Oh, and here’s a kudos for getting to the bottom of this e-mail. :) welcome to the Gitcoin Family!
-
-See you on the interwebs,
-
diff --git a/app/retail/templates/emails/campaigns/email_campaign_day_2.html b/app/retail/templates/emails/campaigns/email_campaign_day_2.html
deleted file mode 100644
index 6e914e8c20f..00000000000
--- a/app/retail/templates/emails/campaigns/email_campaign_day_2.html
+++ /dev/null
@@ -1,92 +0,0 @@
-{% extends 'emails/template.html' %}
-
-{% comment %}
- Copyright (C) 2021 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 .
-
-{% endcomment %}
-
-{% load i18n humanize %}
-
-{% block content %}
-
-
-
-
-
-
Day 2: Finding A Gitcoin Issue For You
-
-
-
- {% trans "Hi" %} {{ firstname }},
-
-
-
- {% blocktrans %}
- By this point, you might have poked around the Gitcoin Issue Explorer to see the open source projects you could make money by contributing! If interested in doing work, here’s how.
- {% endblocktrans %}
-
-
-
Start Work
-
- {% blocktrans %}
- Check if a bounty requires approval from the funder by checking the Permissions section within the bounty.
- {% endblocktrans %}
-
- {% blocktrans %}
- If it states "Permissionless" you can click "Start Work" to provide a short action plan and get started on working.
- {% endblocktrans %}
-
- {% blocktrans %}
- However if it states anything else, you can click the button "Express Interest" to provide a brief message to the bounty owner that you want to work on this issue.
- {% endblocktrans %}
-
- {% blocktrans %}
- From here, you’ll receive an email and a notification when the issue is ready for you to work.
- {% endblocktrans %}
-
-
-
- {% blocktrans %}
- You’ll be able to submit a PR directly onto the repo maintainer’s project from there. It’s that simple!
- {% endblocktrans %}
-
-
-
- {% blocktrans %}
- CTA: Check out the Issue Explorer if you haven’t already! If you don’t find good fits, let us know an open source project that you’d like to see using Gitcoin. No promises, but we might have something up our sleeve.
- {% endblocktrans %}
-
-
-
-
-
-{% endblock %}
diff --git a/app/retail/templates/emails/campaigns/email_campaign_day_2.txt b/app/retail/templates/emails/campaigns/email_campaign_day_2.txt
deleted file mode 100644
index 0871b4f06eb..00000000000
--- a/app/retail/templates/emails/campaigns/email_campaign_day_2.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-Day 2: Finding a Gitcoin issue for you
-
-By this point, you might have poked around the Gitcoin Issue Explorer to see the open source projects you could make money by contributing! If you are interested in start working, here’s how.
-
-Start Work
-Check if a bounty requires approval from the funder by checking the Permissions section within the bounty.
-
-If it states "Permissionless" you can click "Start Work" to provide a short action plan and get started on working.
-
-However if it states anything else, you can click the button "Express Interest" to provide a brief message to the bounty owner that you want to work on this issue. From here, you’ll receive an email and a notification when the issue is ready for you to work.
-
-You’ll be able to submit a PR directly onto the repo maintainer’s project from there. It’s that simple!
-
-CTA: Check out the Issue Explorer if you haven’t already! If you don’t find good fits, let us know an open source project that you’d like to see using Gitcoin. No promises, but we might have something up our sleeve.
diff --git a/app/retail/templates/emails/campaigns/email_campaign_day_3.html b/app/retail/templates/emails/campaigns/email_campaign_day_3.html
deleted file mode 100644
index 525ad8a55d4..00000000000
--- a/app/retail/templates/emails/campaigns/email_campaign_day_3.html
+++ /dev/null
@@ -1,97 +0,0 @@
-{% extends 'emails/template.html' %}
-
-{% comment %}
- Copyright (C) 2021 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 .
-
-{% endcomment %}
-
-{% load i18n humanize %}
-
-{% block content %}
-
-
-
-
- {% blocktrans %}
- Posting a bounty can be done in 90 seconds, once you know Gitcoin is an option to accelerate your development. Adding bounties to an existing project is like adding icing to a cake. We take what’s already great about OSS (mission, freedom, and great people) and add financial incentivization, a home base for projects seeking contributors, funding for developers, and community.
- {% endblocktrans %}
-
-
-
- {% blocktrans %}
- Alongside posting bounties on the Issue Explorer, Gitcoin offers two complimentary products for open source software enthusiasts.
-
-
Codefund: Sustain your OSS project with ethical advertising
-
Gitcoin Grants: Recurring funding for open source projects.
-
-
- {% endblocktrans %}
-
-
-
- {% blocktrans %}
- Over the first week of you joining, we're going to send over some information on key products and education
- tools available in the Gitcoin ecosystem. For now, we have a few areas you can nerd out with us, depending on where
- you're most comfortable.
- {% endblocktrans %}
-
-
-
-
- {% blocktrans %}
- Community is what makes Open Source work. A strong OSS community is inclusive, helpful, and mission-oriented. The Gitcoin community is 20,000 software developers who are focused on the tooling for the new world. Is there a chance that your next career connection could come from the Gitcoin community? Come find out!
- {% endblocktrans %}
-
-
-
-
-
-
-{% endblock %}
diff --git a/app/retail/templates/emails/campaigns/email_campaign_day_3.txt b/app/retail/templates/emails/campaigns/email_campaign_day_3.txt
deleted file mode 100644
index 3a3b3548fde..00000000000
--- a/app/retail/templates/emails/campaigns/email_campaign_day_3.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-Day 3: Leveraging the community
-
-Gitcoin Core is 11 team members, yet we’ve seen contributions from well over 100 developers using Gitcoin. We’d like to see you do the same! Here’s how to leverage a firehose of developer talent to do more, faster.
-
-Posting a bounty can be done in 90 seconds, once you know Gitcoin is an option to accelerate your development. Adding bounties to an existing project is like adding icing to a cake. We take what’s already great about OSS (mission, freedom, and great people) and add financial incentivization, a home base for projects seeking contributors, funding for developers, and community.
-
-Alongside posting bounties on the Issue Explorer, Gitcoin offers two complimentary products for open source software enthusiasts.
-
-Codefund: Sustain your OSS project with ethical advertising
-
-Gitcoin Kudos: Have a contributor that’s doing fantastic work? Send them a token of appreciation using Kudos! Here’s one for you :)
-
-Gitcoin Grants: Recurring funding for open source projects.
-
-Community is what makes Open Source work. A strong OSS community is inclusive, helpful, and mission-oriented. The Gitcoin community is 20,000 software developers who are focused on the tooling for the new world. Is there a chance that your next career connection could come from the Gitcoin community? Come find out!
-
diff --git a/app/retail/templates/emails/grants/transaction_summary.html b/app/retail/templates/emails/grants/transaction_summary.html
deleted file mode 100644
index c1b0e41eec4..00000000000
--- a/app/retail/templates/emails/grants/transaction_summary.html
+++ /dev/null
@@ -1,147 +0,0 @@
-{% extends '../emails/template.html' %}
-{% comment %}
- Copyright (C) 2021 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 .
-{% endcomment %}
-{% load i18n static grants_extra humanize %}
-
-{% block content %}
-
-
-
-
{% trans "Grant" %} '{{ grant.title }}' {% trans "has received more funding" %}!
- Total Grant received
- {{ grant.amount_received }} {% trans "USD" %}
-
-
-
-
-{% trans "View Grant" %}
-
-{% endblock %}
diff --git a/app/retail/templates/emails/grants/transaction_summary.txt b/app/retail/templates/emails/grants/transaction_summary.txt
deleted file mode 100644
index bd8d01d2680..00000000000
--- a/app/retail/templates/emails/grants/transaction_summary.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-{% load i18n humanize %}
-
-{% trans "Transaction Summary" %}
-
-{% trans "Grant" %} {{ grant.title }} {% trans "has received more funding" %}
-
-{{ grant.description }}
-
-{% trans "Funding Received in the Last 24 Hours" %}
-
-{{ subscription.contributor_profile_img }}
-
-{% trans "Grant Funder" %}
-
-{{ subscription.contributor_profile }}
-
-{{ subscription.amount_per_period|floatformat:4|intcomma }}
-
-{{ subscription.contributor_timestamp }}
-
-{{ subscription.contributor_url }}
-
-{% trans "View Transaction" %}
-
-
-{% trans "Amount Received" %}
-
-{{ grant.amount_received }} {% trans "USD" %}
-
-
-{% trans "View Grant" %} {{ grant.reference_url }}
diff --git a/app/retail/templates/emails/grants/update_notification.html b/app/retail/templates/emails/grants/update_notification.html
deleted file mode 100644
index 77ccc6e8e75..00000000000
--- a/app/retail/templates/emails/grants/update_notification.html
+++ /dev/null
@@ -1,158 +0,0 @@
-{% extends 'emails/template.html' %}
-{% comment %}
-Copyright (C) 2021 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
-.
-
-{% endcomment %}
-{% load i18n static %}
-
-{% block content %}
-
-
-
-
- {% endblock %}
\ No newline at end of file
diff --git a/app/retail/templates/emails/grants/update_notification.txt b/app/retail/templates/emails/grants/update_notification.txt
deleted file mode 100644
index 15761d1cd9f..00000000000
--- a/app/retail/templates/emails/grants/update_notification.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-{% load i18n %}
-
-{% trans "Update!" %}
-
-{% trans "An update has been posted for:" %}
-
-{{ grant.title }}
-
-{{ grant.desciption }}
-
-{% trans "New Grant Update." %}
-
-{{ activity.title }}
-
-{{ activity.date }}
-
-{{ activity.description }}
-
-{% trans "View Grant" %} {{ grant.reference_url }}
diff --git a/app/retail/templates/emails/quest_small.html b/app/retail/templates/emails/quest_small.html
deleted file mode 100644
index 963f8423809..00000000000
--- a/app/retail/templates/emails/quest_small.html
+++ /dev/null
@@ -1,111 +0,0 @@
-{% comment %}
- Copyright (C) 2021 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 .
-
-{% endcomment %}
-{% load i18n humanize %}
-
-
-
-
-
- {% if quest and small %}
-
-
-
-
- {% if not quest.enemy_img_url or quest.enemy_img_url == "/static/" %}
-
- {% else %}
-
- {% endif %}
-
-
-
-
-
-
-
{{quest.title}}
-
{{quest.description}}
- {% include 'emails/shared_quest_actions.html' with action='custom' action_copy='Play Quest' action_url=quest.url %}
- {% endif %}
-
- {% if quest and not small %}
-
-
-
-
-
-
-
-
-
- {{quest.title}}
-
- Attempts: {{ quest.attempts.count }} {{quest.token_name}} ({{quest.success_pct}}% Winners!)
-
- Prize: {{quest.kudos_reward.ui_name}}
-
- Posted: {{quest.created_on | naturaltime}}
- {% if quest.tags %}
-
- Tags: {% for tag in quest.tags %}#{{ tag }} {% endfor %}
- {% endif %}
-
-
-
-
- {% include 'emails/shared_quest_actions.html' with action='custom' action_copy='View' action_url=quest.url %}
-
-
-
-
-
- {% endif %}
-
diff --git a/app/retail/templates/emails/shared_activities_actions.html b/app/retail/templates/emails/shared_activities_actions.html
deleted file mode 100644
index 78fdfd24a0c..00000000000
--- a/app/retail/templates/emails/shared_activities_actions.html
+++ /dev/null
@@ -1,31 +0,0 @@
-{% comment %}
- Copyright (C) 2021 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 .
-{% endcomment %}
-{% load i18n humanize %}{% if action == 'custom' %}
-
-{% endif %}
diff --git a/app/retail/templates/jobs.html b/app/retail/templates/jobs.html
deleted file mode 100644
index 8f2c0a4bbaa..00000000000
--- a/app/retail/templates/jobs.html
+++ /dev/null
@@ -1,174 +0,0 @@
-{% comment %}
- Copyright (C) 2021 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
- .
-
-{% endcomment %}
-{% load i18n static %}
-
-
-
-
- {% include 'shared/head.html' %}
- {% include 'shared/cards_pic.html' %}
-
-
-
-
-
-
- {% include 'shared/tag_manager_2.html' %}
- {% include 'shared/top_nav.html' with class='d-md-flex' %}
-
- {% include 'home/nav.html' %}
- {% include 'shared/minihero.html' with h1='Jobs' position_h1_below_logo=1 %}
-
-
-
-
-
-
- {% trans "We are built by & for coders" %}
-
-
-
-
-
-
-
-
{% trans "Gitcoin is built with Gitcoin" %}
-
{% trans "(we dogfood)" %}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {% blocktrans %}
- We believe in try-before-you-buy hiring.
- {% endblocktrans %}
-
-
{% trans "Want to show off your chops? Contribute to some bounties before applying to jobs." %}
-
-
-
-
-
-
-
-
-
- {% blocktrans %}
- We believe in remote work.
- {% endblocktrans %}
-
{% trans "We live and travel all over the world." %}
-
-
-
-
-
-
-
-
-
- {% blocktrans %}
- We believe in open source.
- {% endblocktrans %}
-
-
{% trans "Gitcoin is completely accessible to the public." %}
{% trans "We have no positions available right now."%}
-
-
-
-
- {% endif %}
-
-
- {% include 'shared/footer.html' %}
- {% include 'shared/footer_scripts.html' with slim=1 %}
-
-
-
diff --git a/app/retail/templates/shared/activity-vue.html b/app/retail/templates/shared/activity-vue.html
deleted file mode 100644
index 2417082c460..00000000000
--- a/app/retail/templates/shared/activity-vue.html
+++ /dev/null
@@ -1,425 +0,0 @@
-{% comment %}
- Copyright (C) 2021 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 .
-
-{% endcomment %}
-{% load humanize i18n static %}
-
-
-
diff --git a/app/retail/templates/shared/compass.html b/app/retail/templates/shared/compass.html
deleted file mode 100644
index 1c828622d33..00000000000
--- a/app/retail/templates/shared/compass.html
+++ /dev/null
@@ -1,24 +0,0 @@
-{% comment %}
- Copyright (C) 2021 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 .
-{% endcomment %}
-{% load static %}
-
-
-
-
-
-
-
diff --git a/app/retail/utils.py b/app/retail/utils.py
index ac2f50f2c07..39d17148134 100644
--- a/app/retail/utils.py
+++ b/app/retail/utils.py
@@ -31,7 +31,6 @@
from django.utils.translation import gettext_lazy as _
import pytz
-from cacheops import CacheMiss, cache
from grants.models import Contribution, Grant
from marketing.models import Alumni, LeaderboardRank, ManualStat, Stat
from requests_oauthlib import OAuth2Session
@@ -57,17 +56,6 @@ def profile_time(self, name):
self.last_time = time.time()
-def get_github_user_profile(token):
- github = OAuth2Session(
- settings.GITHUB_CLIENT_ID,
- token=token,
- )
-
- creds = github.get('https://api.github.com/user').json()
- print(creds)
- return creds
-
-
def strip_html(html):
tag_re = re.compile(r'(|<[^>]*>)')
no_tags = tag_re.sub('', html)
diff --git a/app/retail/views.py b/app/retail/views.py
index f1fea51fc44..f0e01395fd5 100644
--- a/app/retail/views.py
+++ b/app/retail/views.py
@@ -17,48 +17,33 @@
along with this program. If not, see .
'''
-import datetime
import json
import logging
import re
-import time
from json import loads as json_parse
-from os import walk as walkdir
from django.conf import settings
-from django.contrib.admin.views.decorators import staff_member_required
-from django.core.exceptions import ValidationError
-from django.core.paginator import Paginator
-from django.core.validators import validate_email
from django.db.models import Count, Q, Subquery
from django.http import Http404, JsonResponse
from django.shortcuts import redirect
from django.template.response import TemplateResponse
from django.templatetags.static import static
-from django.urls import reverse
from django.utils import timezone
-from django.utils.translation import gettext
from django.utils.translation import gettext_lazy as _
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_http_methods
-from app.utils import get_default_network, get_profiles_from_text
-from cacheops import cached_as, cached_view, cached_view_as
-from dashboard.models import (
- Activity, Bounty, HackathonEvent, Profile, Tip, TribeMember, get_my_earnings_counter_profiles, get_my_grants,
-)
+from app.utils import get_profiles_from_text
+from cacheops import cached_view
+from dashboard.models import Activity, HackathonEvent, Profile, Tip, get_my_earnings_counter_profiles, get_my_grants
from dashboard.notifications import amount_usdt_open_work, open_bounties
from dashboard.tasks import grant_update_email_task
from economy.models import Token
-from grants.models import Grant
from marketing.mails import mention_email, new_funding_limit_increase_request, new_token_request, wall_post_email
-from marketing.models import Alumni, EmailInventory, Job, LeaderboardRank
-from marketing.utils import get_or_save_email_subscriber, invite_to_slack
+from marketing.models import EmailInventory
from perftools.models import JSONStore
from ratelimit.decorators import ratelimit
-from retail.emails import render_nth_day_email_campaign
from retail.helpers import get_ip
-from townsquare.models import PinnedPost
from townsquare.tasks import increment_view_counts
from townsquare.utils import can_pin
@@ -923,7 +908,12 @@ def create_status_update(request):
issue_re = re.compile(r'^(?:https?://)?(?:github\.com)/(?:[\w,\-,\_]+)/(?:[\w,\-,\_]+)/issues/(?:[\d]+)')
response = {}
- if request.POST:
+ if request.POST and request.user.is_authenticated:
+ if (request.user.profile.is_blocked or request.user.profile.shadowbanned):
+ response['status'] = 400
+ response['message'] = 'Status updated!'
+ return JsonResponse(response, status=400)
+
profile = request.user.profile
title = request.POST.get('data')
resource = request.POST.get('resource', '')
@@ -934,12 +924,6 @@ def create_status_update(request):
attach_token_name = request.POST.get('attachTokenName', '')
tx_id = request.POST.get('attachTxId', '')
- if request.user.is_authenticated and (request.user.profile.is_blocked or request.user.profile.shadowbanned):
- response['status'] = 200
- response['message'] = 'Status updated!'
- return JsonResponse(response, status=400)
-
-
kwargs = {
'activity_type': 'status_update',
'metadata': {
@@ -1030,6 +1014,11 @@ def create_status_update(request):
response['message'] = 'Bad Request'
logger.error('Status Update error - Error: (%s) - Handle: (%s)', e, profile.handle if profile else '')
return JsonResponse(response, status=400)
+ else:
+ response['status'] = 401
+ response['message'] = 'Not logged in!'
+ return JsonResponse(status=response['status'], data={'status': 401,'message':response['message']})
+
return JsonResponse(response)
diff --git a/app/townsquare/tasks.py b/app/townsquare/tasks.py
index 9b7bcb0c47a..c765cc9e5b7 100644
--- a/app/townsquare/tasks.py
+++ b/app/townsquare/tasks.py
@@ -14,7 +14,7 @@
# Lock timeout of 2 minutes (just in the case that the application hangs to avoid a redis deadlock)
LOCK_TIMEOUT = 60 * 2
-@app.shared_task(bind=True, max_retries=3)
+@app.shared_task(bind=True, soft_time_limit=600, time_limit=660, max_retries=3)
def increment_view_counts(self, pks, retry=False):
"""
:param self:
diff --git a/app/townsquare/utils.py b/app/townsquare/utils.py
index 4861914c07f..5766d0aa69a 100644
--- a/app/townsquare/utils.py
+++ b/app/townsquare/utils.py
@@ -59,7 +59,3 @@ def is_email_townsquare_enabled(email):
if not user:
return False
return is_user_townsquare_enabled(user)
-
-
-def is_there_an_action_available():
- return Offer.objects.current().exists()
diff --git a/docs/ENVIRONMENT_VARIABLES.md b/docs/ENVIRONMENT_VARIABLES.md
index a392eed55a1..75be7185a0e 100644
--- a/docs/ENVIRONMENT_VARIABLES.md
+++ b/docs/ENVIRONMENT_VARIABLES.md
@@ -62,7 +62,6 @@ All of the environment variables used by this application conform to the [`djang
| --- | --- | --- | --- |
| GITHUB_API_BASE_URL | The Github API URL. | `str` | https://api.github.com |
| GITHUB_AUTH_BASE_URL | The Github OAuth authorization URL. | `str` | https://github.com/login/oauth/authorize |
-| GITHUB_TOKEN_URL | The Github OAuth access token URL. | `str` | https://github.com/login/oauth/access_token |
| GITHUB_SCOPE | The Github application scope. | `str` | read:user,user:email,read:org |
| GITHUB_CLIENT_ID | The client ID of the Github OAuth app. | `str` | TODO |
| GITHUB_CLIENT_SECRET | The client secret of the Github OAuth app. | `str` | TODO |
diff --git a/pydocmd.yml b/pydocmd.yml
index 529c84cbd44..9a499b186b6 100644
--- a/pydocmd.yml
+++ b/pydocmd.yml
@@ -15,8 +15,6 @@ generate:
- app.sitemaps++
- app/static_storage.md:
- app.static_storage++
- - app/thumbnail_processors.md:
- - app.thumbnail_processors++
- app/utils.md:
- app.utils++
- avatar/admin.md:
@@ -103,8 +101,6 @@ generate:
- grants.abi++
- grants/admin.md:
- grants.admin++
- - grants/forms.md:
- - grants.forms++
- grants/models.md:
- grants.models++
- grants/router.md:
@@ -222,7 +218,6 @@ pages:
- Auth Pipeline: app/pipeline.md
- Sitemaps: app/sitemaps.md
- Static Storage: app/static_storage.md
- - Thumbnail Processors: app/thumbnail_processors.md
- Utilities: app/utils.md
- Avatar:
- Admin: avatar/admin.md
diff --git a/requirements/base.txt b/requirements/base.txt
index 8f72cfc6a26..c572555ecda 100644
--- a/requirements/base.txt
+++ b/requirements/base.txt
@@ -57,7 +57,6 @@ Werkzeug[watchdog]==0.15.5
imageio
boto3==1.7.81
django-storages==1.11.1
-easy-thumbnails==2.5
eth-account==0.2.2
django-classy-tags==0.8.0
django-cookie-law==2.0.1
diff --git a/scripts/debug/add_grants_team_members.py b/scripts/debug/add_grants_team_members.py
index de1f2f35b69..785ea6e10ab 100644
--- a/scripts/debug/add_grants_team_members.py
+++ b/scripts/debug/add_grants_team_members.py
@@ -1,6 +1,6 @@
from dashboard.models import Profile
from grants.models import *
-from grants.utils import get_leaderboard, is_grant_team_member
+from grants.utils import is_grant_team_member
handles = [
'adamstallard',