Skip to content

Commit

Permalink
Merge branch 'master' into feature/convert2grant
Browse files Browse the repository at this point in the history
  • Loading branch information
sanchaymittal authored Oct 1, 2020
2 parents 67a1e39 + 2e65741 commit eb3a787
Show file tree
Hide file tree
Showing 410 changed files with 70,873 additions and 2,512 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
# Download and cache dependencies
- restore_cache:
keys:
- deps37-{{ .Branch }}-{{ checksum "requirements/base.txt" }}-alpine
- deps37-{{ .Branch }}-{{ checksum "requirements/ci.txt" }}-alpine
# fallback to using the latest cache if no exact match is found
- deps37-{{ .Branch }}-alpine

Expand All @@ -52,7 +52,7 @@ jobs:
echo "Requirements installed!"
- save_cache:
key: deps37-{{ .Branch }}-{{ checksum "requirements/base.txt" }}-alpine
key: deps37-{{ .Branch }}-{{ checksum "requirements/ci.txt" }}-alpine
paths:
- ./venv
- "/usr/local/bin"
Expand Down
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
app/assets/v2/js/event_ethdenver2019/blockies.js
app/assets/v2/js/lib/*
app/assets/v2/js/abi.js
app/assets/landingpage/*

app/assets/onepager/js/confetti.js

Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ jobs:
env:
- PYTHONPATH="${TRAVIS_BUILD_DIR}/app/"
- DJANGO_SETTINGS_MODULE="app.settings"
- SUPRESS_DEBUG_TOOLBAR=1
deploy:
provider: pages
skip-cleanup: true
Expand Down
21 changes: 20 additions & 1 deletion app/app/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from kudos.models import KudosTransfer
from marketing.utils import handle_marketing_callback
from perftools.models import JSONStore
from ptokens.models import PersonalToken
from retail.helpers import get_ip
from townsquare.models import Announcement

Expand Down Expand Up @@ -60,20 +61,23 @@ def get_sitewide_announcements():
announcement = announcements.filter(key='header').first()
if announcement:
header_msg = announcement.title + announcement.desc
nav_salt = announcement.rank
nav_salt = announcement.salt
return header_msg, footer_msg, nav_salt


def preprocess(request):
"""Handle inserting pertinent data into the current context."""

# make lbcheck super lightweight

if request.path == '/lbcheck':
return {}

chat_url = get_chat_url(front_end=True)
chat_access_token = ''
chat_id = ''
ptoken = None

search_url = ''
user_is_authenticated = request.user.is_authenticated
profile = request.user.profile if user_is_authenticated and hasattr(request.user, 'profile') else None
Expand Down Expand Up @@ -115,13 +119,21 @@ def preprocess(request):

chat_access_token = profile.gitcoin_chat_access_token
chat_id = profile.chat_id

ptoken = PersonalToken.objects.filter(token_owner_profile=profile).first()

# handles marketing callbacks
if request.GET.get('cb'):
callback = request.GET.get('cb')
handle_marketing_callback(callback, request)

header_msg, footer_msg, nav_salt = get_sitewide_announcements()

try:
onboard_tasks = JSONStore.objects.get(key='onboard_tasks').data
except JSONStore.DoesNotExist:
onboard_tasks = []

# town square wall post max length
max_length_offset = abs(((
request.user.profile.created_on
Expand Down Expand Up @@ -171,11 +183,18 @@ def preprocess(request):
'is_staff': request.user.is_staff if user_is_authenticated else False,
'is_moderator': profile.is_moderator if profile else False,
'is_alpha_tester': profile.is_alpha_tester if profile else False,
'user_groups': list(profile.user_groups) if profile else False,
'persona_is_funder': profile.persona_is_funder if profile else False,
'persona_is_hunter': profile.persona_is_hunter if profile else False,
'pref_do_not_track': profile.pref_do_not_track if profile else False,
'profile_url': profile.url if profile else False,
'quests_live': settings.QUESTS_LIVE,
'onboard_tasks': onboard_tasks,
'ptoken_abi': settings.PTOKEN_ABI,
'ptoken_factory_address': settings.PTOKEN_FACTORY_ADDRESS,
'ptoken_factory_abi': settings.PTOKEN_FACTORY_ABI,
'ptoken_address': ptoken.token_address if ptoken else '',
'ptoken_id': ptoken.id if ptoken else None
}
context['json_context'] = json.dumps(context)
context['last_posts'] = cache.get_or_set('last_posts', fetchPost, 5000)
Expand Down
47 changes: 46 additions & 1 deletion app/app/fixtures/economy.json
Original file line number Diff line number Diff line change
Expand Up @@ -24320,13 +24320,58 @@
"fields": {
"created_on": "2019-09-09T00:52:18Z",
"modified_on": "2019-09-11T01:38:48.009Z",
"address": "0x6A9865aDE2B6207dAAC49f8bCba9705dEB0B0e6D",
"address": "0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa",
"symbol": "DAI",
"network": "rinkeby",
"decimals": 18,
"priority": 1,
"metadata": {},
"approved": true
}
},
{
"model": "economy.token",
"pk": 363,
"fields": {
"created_on": "2020-08-28T00:52:18Z",
"modified_on": "2020-08-28T01:38:48.009Z",
"address": "0x3b00ef435fa4fcff5c209a37d1f3dcff37c705ad",
"symbol": "USDT",
"network": "rinkeby",
"decimals": 6,
"priority": 1,
"metadata": {},
"approved": true
}
},
{
"model": "economy.token",
"pk": 364,
"fields": {
"created_on": "2020-08-28T00:52:18Z",
"modified_on": "2020-08-28T01:38:48.009Z",
"address": "0xeb8f08a975ab53e34d8a0330e0d34de942c95926",
"symbol": "USDC",
"network": "rinkeby",
"decimals": 6,
"priority": 1,
"metadata": {},
"approved": true
}
},
{
"model": "economy.token",
"pk": 364,
"fields": {
"created_on": "2020-08-28T00:52:18Z",
"modified_on": "2020-08-28T01:38:48.009Z",
"address": "0x4da8d0795830f75be471f072a034d42c369b5d0a",
"symbol": "LINK",
"network": "rinkeby",
"decimals": 18,
"priority": 1,
"metadata": {},
"approved": true
}
}
]
10 changes: 5 additions & 5 deletions app/app/fixtures/grants.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"contract_owner_address": "0xBcAfdD642118e5536024675e776d32413728dd08",
"monthly_amount_subscribed": "0.0000",
"amount_received": "5.0000",
"token_address": "0x6A9865aDE2B6207dAAC49f8bCba9705dEB0B0e6D",
"token_address": "0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa",
"token_symbol": "DAI",
"contract_address": "0x3DDDC3Bedc5e9E65139d3Ee89E25fa32022dbE2f",
"deploy_tx_id": "0x4bfa9e3469d8e5feb66ee00f94b7eea7b0d3518bee00a797c2d8cb52a7b39c3c",
Expand Down Expand Up @@ -117,7 +117,7 @@
"real_period_seconds": "0",
"frequency_unit": "days",
"frequency": "30",
"token_address": "0x6A9865aDE2B6207dAAC49f8bCba9705dEB0B0e6D",
"token_address": "0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa",
"token_symbol": "DAI",
"gas_price": "250.0000",
"new_approve_tx_id": "0xd89376ee2a96557f4e9038ae59610b590987e48994d45b55ba6588e171d0678b",
Expand Down Expand Up @@ -149,7 +149,7 @@
"real_period_seconds": "2592000",
"frequency_unit": "days",
"frequency": "30",
"token_address": "0x6A9865aDE2B6207dAAC49f8bCba9705dEB0B0e6D",
"token_address": "0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa",
"token_symbol": "DAI",
"gas_price": "2500.0000",
"new_approve_tx_id": "0x49d52af7bdfaf14224f22f6466550ca61b8261593e68be4bd11ac42ddafcf99a",
Expand Down Expand Up @@ -181,7 +181,7 @@
"real_period_seconds": "0",
"frequency_unit": "days",
"frequency": "30",
"token_address": "0x6A9865aDE2B6207dAAC49f8bCba9705dEB0B0e6D",
"token_address": "0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa",
"token_symbol": "DAI",
"gas_price": "250.0000",
"new_approve_tx_id": "0x723b608a34521a9ddade1cc8d8f2b720edddd1db7dd2c2fdeb04b046fab32251",
Expand Down Expand Up @@ -213,7 +213,7 @@
"real_period_seconds": "2592000",
"frequency_unit": "days",
"frequency": "30",
"token_address": "0x6A9865aDE2B6207dAAC49f8bCba9705dEB0B0e6D",
"token_address": "0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa",
"token_symbol": "DAI",
"gas_price": "25000.0000",
"new_approve_tx_id": "0x980ce738853f454c83d5551dc086a29d2d89781fb041a9ce581474ffdf639de4",
Expand Down
39 changes: 37 additions & 2 deletions app/app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import json
import os
import socket

Expand Down Expand Up @@ -60,9 +61,11 @@
PYPL_CLIENT_ID = env('PYPL_CLIENT_ID', default='')

# Ratelimit
FLUSH_QUEUE = env.bool('FLUSH_QUEUE', default=False)
RATELIMIT_ENABLE = env.bool('RATELIMIT_ENABLE', default=True)
RATELIMIT_USE_CACHE = env('RATELIMIT_USE_CACHE', default='default')
RATELIMIT_VIEW = env('RATELIMIT_VIEW', default='tdi.views.ratelimited')
BLOCKNATIVE_API = env('BLOCKNATIVE_API', default='')

ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', default=['*'])
CSRF_TRUSTED_ORIGINS = env.list('CSRF_TRUSTED_ORIGINS', default=['localhost'])
Expand Down Expand Up @@ -104,6 +107,7 @@
'app',
'avatar',
'retail',
'ptokens',
'rest_framework',
'marketing',
'economy',
Expand Down Expand Up @@ -179,7 +183,7 @@

TEMPLATES = [{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['chat/templates/', 'retail/templates/', 'dataviz/templates', 'kudos/templates', 'inbox/templates', 'quests/templates', 'townsquare/templates'],
'DIRS': ['chat/templates/', 'retail/templates/', 'dataviz/templates', 'kudos/templates', 'inbox/templates', 'quests/templates', 'townsquare/templates', 'ptokens/templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
Expand Down Expand Up @@ -513,6 +517,22 @@ def callback(request):
CELERY_RESULT_SERIALIZER = 'json'
# http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-result_backend
CELERY_RESULT_BACKEND = env('CELERY_RESULT_BACKEND', default=CACHEOPS_REDIS)
# https://docs.celeryproject.org/en/latest/userguide/configuration.html#std-setting-task_routes
CELERY_ROUTES = [
('grants.tasks.process_grant_contribution', {'queue': 'high_priority'}),
('kudos.tasks.mint_token_request', {'queue': 'high_priority'}),
('marketing.tasks.*', {'queue': 'marketing'}),
('grants.tasks.*', {'queue': 'default'}),
('chat.tasks.*', {'queue': 'default'}),
('dashboard.tasks.*', {'queue': 'default'}),
('townsquare.tasks.*', {'queue': 'default'}),
('kudos.tasks.*', {'queue': 'default'}),
]
if DEBUG:
CELERY_ROUTES = [
('*', {'queue': 'default'}),
]


DJANGO_REDIS_IGNORE_EXCEPTIONS = env.bool('REDIS_IGNORE_EXCEPTIONS', default=True)
DJANGO_REDIS_LOG_IGNORED_EXCEPTIONS = env.bool('REDIS_LOG_IGNORED_EXCEPTIONS', default=True)
Expand Down Expand Up @@ -823,6 +843,19 @@ def callback(request):


ELASTIC_SEARCH_URL = env('ELASTIC_SEARCH_URL', default='')
PTOKEN_ABI_PATH = env('PTOKEN_ABI_PATH', default='assets/v2/js/ptokens/ptoken-abi.json')
PTOKEN_FACTORY_ABI_PATH = env('PTOKEN_FACTORY_ABI_PATH', default='assets/v2/js/ptokens/factory-abi.json')
PTOKEN_FACTORY_ADDRESS = env('PTOKEN_FACTORY_ADDRESS', default='0x75589C2e56095c80f63EC773509f033aC595c34e')
PTOKEN_ABI = ''
PTOKEN_FACTORY_ABI = ''

if PTOKEN_ABI_PATH:
with open(str(root.path(PTOKEN_ABI_PATH))) as f:
PTOKEN_ABI = json.load(f)

if PTOKEN_FACTORY_ABI_PATH:
with open(str(root.path(PTOKEN_FACTORY_ABI_PATH))) as f:
PTOKEN_FACTORY_ABI = json.load(f)

HAYSTACK_ELASTIC_SEARCH_URL = env('HAYSTACK_ELASTIC_SEARCH_URL', default='')

Expand All @@ -846,5 +879,7 @@ def callback(request):
PHONE_SALT = env('PHONE_SALT', default='THIS_IS_INSECURE_CHANGE_THIS_PLEASE')

HYPERCHARGE_BOUNTIES_PROFILE_HANDLE = env('HYPERCHARGE_BOUNTIES_PROFILE', default='gitcoinbot')
ADDEVENT_CLIENT_ID = env('ADDEVENT_CLIENT_ID', default='')
ADDEVENT_API_TOKEN = env('ADDEVENT_API_TOKEN', default='')

BRIGHTID_PRIVATE_KEY = env('BRIGHTID_PRIVATE_KEY', default='wrong-private-key')
BRIGHTID_PRIVATE_KEY = env('BRIGHTID_PRIVATE_KEY', default='wrong-private-key')
4 changes: 2 additions & 2 deletions app/app/templates/search/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<link rel="stylesheet" href={% static "v2/css/users.css" %} />
<link rel="stylesheet" href={% static "v2/css/tag.css" %} />
<link rel="stylesheet" href={% static "v2/css/rating.css" %} />
<link rel="stylesheet" href="https://unpkg.com/vue-innersearch/default-innersearch-theme.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vue-innersearch@0.0.12/default-innersearch-theme.min.css">
</head>

<body id="{{ explore }}" class="interior {{active}} g-font-muli">
Expand Down Expand Up @@ -156,7 +156,7 @@ <h3 class="is-nlf-title">Number of Hacks Joined : </h3>
{% include 'shared/analytics.html' %}
{% include 'shared/footer_scripts.html' %}
{% include 'shared/footer.html' %}
<script src="https://unpkg.com/[email protected]/vue-innersearch.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/innersearch.min.js"></script>


<script>
Expand Down
Loading

0 comments on commit eb3a787

Please sign in to comment.