Skip to content

Commit

Permalink
Merge branch 'stable' of github.com:gitcoinco/web into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
amustapha committed Jan 8, 2021
2 parents 14fad08 + 8add9d1 commit 1ac4c3f
Show file tree
Hide file tree
Showing 111 changed files with 1,109 additions and 2,466 deletions.
9 changes: 4 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ os:
services:
- docker
- postgresql
- redis-server
- redis

cache:
npm: false
Expand All @@ -24,12 +24,12 @@ jobs:
# Lint and test the repository.
- stage: lint-test
before_script:
- nvm install "14"
- psql -c 'create database testdb;' -U postgres
script:
# Setup Env.
- cp app/app/travis.env app/app/.env
- pip install pip setuptools --upgrade
- pip install codecov
- pip install pip==20.0.2 setuptools --upgrade
# Fetch and Install GeoIP database files.
- sudo apt-get update && sudo apt-get install -y libmaxminddb-dev
# Download links no more valid
Expand All @@ -42,13 +42,12 @@ jobs:
# Install libvips dependencies.
- sudo apt-get install -y libvips libvips-dev
# Install Node and Python dependencies.
- node --version
- npm install
- pip install -r requirements/test.txt
- npm run eslint
- npm run stylelint
- pytest -p no:ethereum -p no:warnings
# Publish CodeCov coverage results.
- codecov
# Generate Markdown documentation and static docs page.
- pydocmd build
env:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ RUN mkdir -p /usr/share/GeoIP/ && \
mv GeoLite2-Country_20200128/*.mmdb /usr/share/GeoIP/

# Upgrade package essentials.
RUN pip3 install --upgrade pip setuptools wheel dumb-init pipenv
RUN pip3 install --upgrade pip==20.0.2 setuptools wheel dumb-init pipenv

COPY requirements/ /code/
RUN apt-get update
Expand Down
18 changes: 3 additions & 15 deletions app/app/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import requests
from app.utils import get_location_from_ip
from cacheops import cached_as
from chat.tasks import get_chat_url
from dashboard.models import Activity, Tip, UserAction
from dashboard.utils import _get_utm_from_cookie
from kudos.models import KudosTransfer
Expand Down Expand Up @@ -73,9 +72,6 @@ def preprocess(request):
if request.path == '/lbcheck':
return {}

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

search_url = ''
Expand Down Expand Up @@ -117,9 +113,6 @@ def preprocess(request):
if record_join:
Activity.objects.create(profile=profile, activity_type='joined')

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
Expand Down Expand Up @@ -147,16 +140,10 @@ def preprocess(request):
'max_length': max_length,
'max_length_offset': max_length_offset,
'search_url': f'{settings.BASE_URL}user_lookup',
'chat_url': chat_url,
'base_url': settings.BASE_URL,
'chat_id': chat_id,
'chat_access_token': chat_access_token,
'github_handle': request.user.username.lower() if user_is_authenticated else False,
'email': request.user.email if user_is_authenticated else False,
'name': request.user.get_full_name() if user_is_authenticated else False,
'last_chat_status':
request.user.profile.last_chat_status if
(hasattr(request.user, 'profile') and user_is_authenticated) else False,
'raven_js_version': settings.RAVEN_JS_VERSION,
'raven_js_dsn': settings.SENTRY_JS_DSN,
'release': settings.RELEASE,
Expand All @@ -178,7 +165,6 @@ def preprocess(request):
'protocol': settings.IPFS_API_SCHEME,
'root': settings.IPFS_API_ROOT,
},
'chat_persistence_frequency': 90 * 1000,
'access_token': profile.access_token if profile else '',
'is_staff': request.user.is_staff if user_is_authenticated else False,
'is_moderator': profile.is_moderator if profile else False,
Expand All @@ -194,7 +180,9 @@ def preprocess(request):
'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
'ptoken_id': ptoken.id if ptoken else None,
'match_payouts_abi': settings.MATCH_PAYOUTS_ABI,
'match_payouts_address': settings.MATCH_PAYOUTS_ADDRESS,
}
context['json_context'] = json.dumps(context)
context['last_posts'] = cache.get_or_set('last_posts', fetchPost, 5000)
Expand Down
16 changes: 5 additions & 11 deletions app/app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@
'marketing',
'economy',
'dashboard',
'chat',
'quests',
'faucet',
'tdi',
Expand Down Expand Up @@ -182,7 +181,7 @@

TEMPLATES = [{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['chat/templates/', 'retail/templates/', 'dataviz/templates', 'kudos/templates', 'inbox/templates', 'quests/templates', 'townsquare/templates', 'ptokens/templates'],
'DIRS': ['retail/templates/', 'dataviz/templates', 'kudos/templates', 'inbox/templates', 'quests/templates', 'townsquare/templates', 'ptokens/templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
Expand Down Expand Up @@ -522,7 +521,6 @@ def callback(request):
('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'}),
Expand Down Expand Up @@ -610,14 +608,6 @@ def callback(request):
# Kudos revenue account
KUDOS_REVENUE_ACCOUNT_ADDRESS = env('KUDOS_REVENUE_ACCOUNT_ADDRESS', default='0xdb282cee382244e05dd226c8809d2405b76fbdc9')

# Chat
CHAT_PORT = env('CHAT_PORT', default=8065) # port of where mattermost is hosted
CHAT_URL = env('CHAT_URL', default='localhost') # location of where mattermost is hosted
CHAT_SERVER_URL = env('CHAT_SERVER_URL', default='chat') # location of where mattermost is hosted
CHAT_DRIVER_TOKEN = env('CHAT_DRIVER_TOKEN', default='') # driver token
GITCOIN_HACK_CHAT_TEAM_ID = env('GITCOIN_HACK_CHAT_TEAM_ID', default='')
GITCOIN_CHAT_TEAM_ID = env('GITCOIN_CHAT_TEAM_ID', default='')
GITCOIN_LEADERBOARD_CHANNEL_ID = env('GITCOIN_LEADERBOARD_CHANNEL_ID', default='')
# Social Auth
LOGIN_URL = 'gh_login'
LOGOUT_URL = 'logout'
Expand Down Expand Up @@ -885,3 +875,7 @@ def callback(request):
# Idena
IDENA_TOKEN_EXPIRY = 60 * 60 # 1 Hours
IDENA_NONCE_EXPIRY = 60 * 2 # 2 Min

# Match Payouts contract
MATCH_PAYOUTS_ABI = '[ { "inputs": [ { "internalType": "address", "name": "_owner", "type": "address" }, { "internalType": "address", "name": "_funder", "type": "address" }, { "internalType": "contract IERC20", "name": "_dai", "type": "address" } ], "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [], "name": "Finalized", "type": "event" }, { "anonymous": false, "inputs": [], "name": "Funded", "type": "event" }, { "anonymous": false, "inputs": [], "name": "FundingWithdrawn", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "address", "name": "recipient", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "PayoutAdded", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "address", "name": "recipient", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "PayoutClaimed", "type": "event" }, { "inputs": [ { "internalType": "address", "name": "_recipient", "type": "address" } ], "name": "claimMatchPayout", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "dai", "outputs": [ { "internalType": "contract IERC20", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "enablePayouts", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "finalize", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "funder", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "", "type": "address" } ], "name": "payouts", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "components": [ { "internalType": "address", "name": "recipient", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "internalType": "struct MatchPayouts.PayoutFields[]", "name": "_payouts", "type": "tuple[]" } ], "name": "setPayouts", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "state", "outputs": [ { "internalType": "enum MatchPayouts.State", "name": "", "type": "uint8" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "withdrawFunding", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ]'
MATCH_PAYOUTS_ADDRESS = '0xf2354570bE2fB420832Fb7Ff6ff0AE0dF80CF2c6'
2 changes: 1 addition & 1 deletion app/app/sitemaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def items(self):
'dashboard', 'new_funding', 'tip', 'terms', 'privacy', 'cookie', 'prirp', 'apitos', 'about', 'index',
'help', 'whitepaper', 'whitepaper_access', '_leaderboard', 'faucet', 'mission', 'slack', 'labs', 'results',
'activity', 'kudos_main', 'kudos_marketplace', 'grants', 'funder_bounties', 'quests_index', 'newquest',
'products', 'chat', 'avatar_landing'
'products', 'avatar_landing'
]

def location(self, item):
Expand Down
5 changes: 0 additions & 5 deletions app/app/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

import avatar.views
import bounty_requests.views
import chat.views
import credits.views
import dashboard.embed
import dashboard.gas_views
Expand Down Expand Up @@ -71,7 +70,6 @@
url('^api/v1/bounty/fulfill', dashboard.views.fulfill_bounty_v1, name='fulfill_bounty_v1'),
path('api/v1/bounty/<int:bounty_id>/close', dashboard.views.close_bounty_v1, name='close_bounty_v1'),
path('api/v1/bounty/payout/<int:fulfillment_id>', dashboard.views.payout_bounty_v1, name='payout_bounty_v1'),
re_path(r'.*api/v0.1/chat/presence$', chat.views.chat_presence, name='chat_presence'),
re_path(r'.*api/v0.1/video/presence$', townsquare.views.video_presence, name='video_presence'),

# inbox
Expand Down Expand Up @@ -221,8 +219,6 @@
url(r'^api/v1/onboard_save/', dashboard.views.onboard_save, name='onboard_save'),
url(r'^api/v1/file_upload/', dashboard.views.file_upload, name='file_upload'),

# chat
url(r'^chat/login/', chat.views.chat_login, name='chat_login'),
# Health check endpoint
re_path(r'^health/', include('health_check.urls')),
re_path(r'^lbcheck/?', healthcheck.views.lbcheck, name='lbcheck'),
Expand Down Expand Up @@ -681,7 +677,6 @@
faucet.views.process_faucet_request,
name='process_faucet_request'
),
re_path(r'^_administration/bulkDM/', dashboard.views.bulkDM, name='bulkDM'),
re_path(r'^_administration/bulkemail/', dashboard.views.bulkemail, name='bulkemail'),
re_path(
r'^_administration/email/start_work_approved$', retail.emails.start_work_approved, name='start_work_approved'
Expand Down
9 changes: 0 additions & 9 deletions app/app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,6 @@ def actually_sync_profile(handle, user=None, hide_profile=True):
profile.email = user.email
profile.save()

if profile is not None and (profile.chat_id is '' or profile.gitcoin_chat_access_token is ''):

try:
from chat.tasks import associate_chat_to_profile
# created, profile = associate_chat_to_profile(profile)

except Exception as e:
logger.error(str(e))

except UserSocialAuth.DoesNotExist:
pass
else:
Expand Down
67 changes: 1 addition & 66 deletions app/assets/v2/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,6 @@ html {
--profile-step: var(--gc-blue);
}


.iframe-embed-loading {
margin-top:50% !important;
}

#sidebar-chat .b-sidebar-body {
overflow-y: hidden !important;
}

.chatWrapper iframe {
width: 100%;
min-height: 100vh;
}

div.body {
min-height: 400px;
}
Expand Down Expand Up @@ -1602,65 +1588,14 @@ div.busyOverlay {
.online_now:hover {
font-weight: bold;
}
.chat_presence_indicator {
font-size: 12px;
padding: 0px;
list-style: none;
display: inline-block;
cursor: pointer;
margin-bottom: 0px;
margin-left: 5px;
font-weight: normal;
vertical-align: middle;
}
.chat_presence_indicator .indicator {
vertical-align: middle;
content: "\2022";
font-size: 42px;
color: #aaa;
font-weight: bold;
display: inline-block;
margin-top: -12px;
margin-bottom: 0px;
line-height: 10px;
}
.chat_presence_indicator.online .indicator {
color: #0fce7c;
}
.chat_presence_indicator.away .indicator {
color: orange;
}
.chat_presence_indicator.dnd .indicator {
color: red;
}
.chat_presence_indicator.mini {
padding: 0px 1px;
font-size: 10px;
margin-left: 0px;
}
.chat_presence_indicator.mini .indicator {
font-size: 24px;
line-height: 0px
}

.indie_chat_indicator{
color: #0fce7c;
display: inline;
}
.indie_chat_indicator.offline{
color: #aaa;
}
.navbar .chat_presence_indicator:hover{
background-color: rgba(0,0,0,.5);
border-radius: 5px;
}
.navbar .chat_presence_indicator{
position: relative;
left: -16px;
top: -4px;
}
.navbar .chat_presence_indicator .indicator{
font-size: 22px;
}

.bg-shade-0 {
background: var(--bg-shade-0);
Expand Down
2 changes: 1 addition & 1 deletion app/assets/v2/css/gitcoin.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ h4,
.sticky-top {
position: sticky!important;
top: 0;
z-index: 3;
z-index: 1;
}

.lighter {
Expand Down
1 change: 1 addition & 0 deletions app/assets/v2/images/avatar3d/qlands_pix.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/assets/v2/images/avatar3d/qlands_unicorn.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/v2/images/results_preview.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 12 additions & 26 deletions app/assets/v2/js/activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -807,46 +807,33 @@ $(document).ready(function() {
<div class="col-11 activity_comments_main pl-4 px-sm-3">
<div class="mb-0">
<span>
<span class="chat_presence_indicator mini ${comment['last_chat_status']}" data-openchat="${comment['profile_handle']}">
<span class="indicator" data-toggle="tooltip" title="Gitcoin Chat: ${comment['last_chat_status_title']}">
</span>
</span>
<b>${comment['name']}</b>
<span class="grey"><a class=grey href="/profile/${comment['profile_handle']}" data-usercard="${comment['profile_handle']}">
@${comment['profile_handle']}
</a></span>
${comment['match_this_round'] ? `
<span class="tip_on_comment" data-pk="${comment['id']}" data-username="${comment['profile_handle']}" style="border-radius: 3px; border: 1px solid white; color: white; background-color: black; cursor:pointer; padding: 2px; font-size: 10px;" data-placement="bottom" data-toggle="tooltip" data-html="true" title="@${comment['profile_handle']} is estimated to be earning <strong>$${comment['match_this_round']}</strong> in this week's CLR Round.
<BR><BR>
Want to help @${comment['profile_handle']} move up the rankings? Assuming you haven't contributed to @${comment['profile_handle']} yet this round, a contribution of 0.001 ETH (about $0.30) could mean +<strong>$${Math.round(1000 * comment['default_match_round']) / 1000}</strong> in matching.
<br>
<br>
Other contribution levels will mean other matching amounts:
<ul>
${sorted_match_curve_html}
</ul>
<br>Want to learn more? Go to gitcoin.co/townsquare and checkout the CLR Matching Round Leaderboard.
">
Want to help @${comment['profile_handle']} move up the rankings? Assuming you haven't contributed to @${comment['profile_handle']} yet this round, a contribution of 0.001 ETH (about $0.30) could mean +<strong>$${Math.round(1000 * comment['default_match_round']) / 1000}</strong> in matching.
<br>
<br>
Other contribution levels will mean other matching amounts:
<ul>
${sorted_match_curve_html}
</ul>
<br>Want to learn more? Go to gitcoin.co/townsquare and checkout the CLR Matching Round Leaderboard.
">
<i class="fab fa-ethereum mr-0" aria-hidden="true"></i>
$${comment['match_this_round']} | +$${Math.round(100 * comment['default_match_round']) / 100}
</span>
` : ' '}
</span>` : ' '}
</span>
<span class='float-right'>
<span class="d-none d-sm-inline grey font-smaller-5 text-right">
${timeAgo} ${is_edited ? '(edited)' : ''}
</span>
<span class="comment_options font-smaller-5 mt-1" style="display: block; text-align: right;">
${is_comment_owner ?
`<i data-pk=${comment['id']} class="delete_comment fas fa-trash font-smaller-7 position-relative grey mr-1 cursor-pointer" style="top:-1px; "></i>| `
: ''}
${is_comment_owner ?
`<i data-pk=${comment['id']} class="edit_comment fas fa-edit font-smaller-7 position-relative grey mr-1 cursor-pointer" style="top:-1px; "></i>| `
: ''}
${is_comment_owner ? `<i data-pk=${comment['id']} class="delete_comment fas fa-trash font-smaller-7 position-relative grey mr-1 cursor-pointer" style="top:-1px; "></i>| ` : ''}
${is_comment_owner ? `<i data-pk=${comment['id']} class="edit_comment fas fa-edit font-smaller-7 position-relative grey mr-1 cursor-pointer" style="top:-1px; "></i>| ` : ''}
${show_tip ? `
<span class="action like px-0 ${comment['is_liked'] ? 'open' : ''}" data-toggle="tooltip" title="Liked by ${comment['likes']}">
<i class="far fa-heart grey"></i> <span class=like_count>${comment['like_count']}</span>
Expand Down Expand Up @@ -1158,7 +1145,6 @@ $(document).ready(function() {

$('[data-toggle="popover"]').popover();
$('[data-toggle="tooltip"]').bootstrapTooltip();
openChat();

$('.comment_activity').each(function() {
var open = $(this).data('open');
Expand Down
Loading

0 comments on commit 1ac4c3f

Please sign in to comment.