Skip to content

Commit

Permalink
Merge pull request #7514 from gitcoinco/stable
Browse files Browse the repository at this point in the history
Stable
  • Loading branch information
octavioamu authored Sep 23, 2020
2 parents 264d67f + 43415f1 commit 7600a82
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 7 deletions.
1 change: 1 addition & 0 deletions app/app/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ 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,
Expand Down
8 changes: 5 additions & 3 deletions app/assets/v2/js/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Vue.component('grants-cart', {
selectedNetwork: undefined, // used to force computed properties to update when document.web3network changes
zkSyncFeeTotals: {}, // used to dispaly a string showing the total zkSync fees when checking out with Flow B
zkSyncFeesString: undefined, // string generated from the above property
isZkSyncDown: true, // true if zkSync is having issues with their servers
// SMS validation
csrf: $("input[name='csrfmiddlewaretoken']").val(),
validationStep: 'intro',
Expand Down Expand Up @@ -1748,17 +1749,18 @@ Vue.component('grants-cart', {
// Get worst case fee amount
this.zkSyncFeeTotals[tokenSymbol] = await this.getMaxFee(tokenSymbol);
this.setZkSyncFeesString();


// Note: Don't `break` out of the if statements if insufficient balance, because we
// also use this function to set the fee string shown to the user on the checkout modal

// Balance will be undefined if the user does not have that token, so we can break
if (!balance) {
this.hasSufficientZkSyncBalance = false;
break;
}

// Otherwise, we compare their balance against the required amount
if (ethers.BigNumber.from(balance).lt(totalRequiredAmount)) {
this.hasSufficientZkSyncBalance = false;
break;
}
}
} catch (e) {
Expand Down
4 changes: 4 additions & 0 deletions app/dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3413,6 +3413,10 @@ def is_alpha_tester(self):
return True
return self.user.groups.filter(name='Alpha_Testers').cache().exists() if self.user else False

@property
def user_groups(self):
return self.user.groups.all().cache().values_list('name', flat=True) if self.user else False

@property
def is_staff(self):
"""Determine whether or not the user is a staff member.
Expand Down
8 changes: 5 additions & 3 deletions app/dashboard/templates/bounty/new_bounty.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,11 @@ <h1 class="text-center">Fund Issue</h1>
</label>
{% endif %}

<label class="btn btn-radio chain-btn d-flex align-items-center mr-2 mb-2 font-weight-bold py-2 px-4" :class="{'active': chainId === 58}">
<input type="radio" name="bounty_chain" id="58_chain" value="58" v-model="chainId"><img class="mr-2" src="{% static 'v2/images/chains/polkadot.svg' %}" alt="" width="16"> Polkadot
</label>
{% if 'polkadot_testers' in user_groups or is_staff %}
<label class="btn btn-radio chain-btn d-flex align-items-center mr-2 mb-2 font-weight-bold py-2 px-4" :class="{'active': chainId === 58}">
<input type="radio" name="bounty_chain" id="58_chain" value="58" v-model="chainId"><img class="mr-2" src="{% static 'v2/images/chains/polkadot.svg' %}" alt="" width="16"> Polkadot
</label>
{% endif %}

<label class="btn btn-radio chain-btn d-flex align-items-center mr-2 mb-2 font-weight-bold py-2 px-4" :class="{'active': chainId === '61'}">
<input type="radio" name="bounty_chain" id="61_chain" value="61" v-model="chainId"><img class="mr-2" src="{% static 'v2/images/chains/ethereum-classic.svg' %}" alt="" width="16"> ETC
Expand Down
3 changes: 2 additions & 1 deletion app/dashboard/templates/dashboard/hackathon/new_bounty.html
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ <h1 class="text-center">Fund Prize</h1>
<label class="btn btn-radio chain-btn d-flex align-items-center mr-2 mb-2 font-weight-bold py-2 px-4" :class="{'active': chainId === '666'}">
<input type="radio" name="bounty_chain" id="666_chain" value="666" v-model="chainId"><img class="mr-2" src="{% static 'v2/images/chains/paypal.svg' %}" alt="" width="16"> PayPal
</label>

{% endif %}
{% if 'polkadot_testers' in user_groups or is_staff %}
<label class="btn btn-radio chain-btn d-flex align-items-center mr-2 mb-2 font-weight-bold py-2 px-4" :class="{'active': chainId === 58}">
<input type="radio" name="bounty_chain" id="58_chain" value="58" v-model="chainId"><img class="mr-2" src="{% static 'v2/images/chains/polkadot.svg' %}" alt="" width="16"> Polkadot
</label>
Expand Down
5 changes: 5 additions & 0 deletions app/grants/templates/grants/cart-vue.html
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,11 @@ <h2 class="middle-line mb-3"><span class="text-muted font-body">or</span></h2>
</button>
</template>
<template v-if="isZkSyncModalLoading" v-slot:default="{ hide }">
<div v-if="isZkSyncDown" class="p-2" style="background-color: #FFF6CF; width: 100%;">
The zkSync servers are currently having some issues. If you are stuck on this
loading screen, try refreshing the page. If that does not resolve the issue,
you may want to proceed with Standard Checkout or try again later.
</div>
<div class="my-5 py-5">
<loading-screen></loading-screen>
<div class="text-center my-5">Loading...</div>
Expand Down

0 comments on commit 7600a82

Please sign in to comment.