Skip to content

Commit

Permalink
allow disabling checkout via admin (#9870)
Browse files Browse the repository at this point in the history
* fix: apply the cap after normalising the distribution (#9846)

* fix: apply the cap after normalising the distribution

* fix: adds flag to estimate_clr so that we can skip saving the results

* fix: expose id and title to make it easier to compare results

* fix: apply Adityas comments

* add logging

* add more logs

* add logging

* fix: adds id to totals

* fix: clean up logs

* fix: ensures we dont spread the remainder if we havent reached the saturation point

* fix: debug output

Co-authored-by: Aditya Anand M C <[email protected]>

* fix: enable search in GrantCLRCalculation admin

* fix: ensures props are available for str of questAttempt

* fix: prevents bigNumber overflow (#9862)

* allow disabling checkout via admin

Co-authored-by: Graham Dixon <[email protected]>
Co-authored-by: Graham Dixon <[email protected]>
  • Loading branch information
3 people authored Dec 14, 2021
1 parent a1b44bb commit d18337c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/assets/v2/js/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ Vue.component('grants-cart', {
zkSyncEstimatedGasCost: undefined, // Used to tell user which checkout method is cheaper
polygonSupportedTokens: [], // Used to inform user which tokens in their cart are on Polygon
polygonEstimatedGasCost: undefined, // Used to tell user which checkout method is cheaper
isZkSyncDown: false, // disable zkSync when true
isPolygonDown: false, // disable polygon when true
isZkSyncDown: document.disableZksync, // disable zkSync when true
isPolygonDown: document.disablePolygon, // disable polygon when true
isPolkadotExtInstalled: false,
chainScripts: {
'POLKADOT': [
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 @@ -219,6 +219,11 @@ <h4 class="font-weight-bold mb-5 my-md-0">Discover Grants</h4>
document.authenticated = {{ authenticated | yesno:"true,false" }};
document.isFullyVerified = '{{is_fully_verified}}' === 'True';
document.polygonGasPrice = "{{ gas_prices|get_item:'polygon' }}"

// Checkout Status
document.disableZksync = '{{ disableZksync }}' === 'true';
document.disablePolygon = '{{ disablePolygon }}' === 'true';

</script>
{% bundle merge_js file qrcode %}
<script src="qrcode.min.js" base-dir="/node_modules/qrcodejs/"></script>
Expand Down
12 changes: 12 additions & 0 deletions app/grants/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2417,10 +2417,22 @@ def get_replaced_tx(request):


def grants_cart_view(request):

try:
checkout_status = StaticJsonEnv.objects.get(key='L2_CHECKOUT_STATUS').data
disableZksync = checkout_status['disableZksync']
disablePolygon = checkout_status['disablePolygon']
except:
disableZksync = 'false'
disablePolygon = 'false'

context = {
'title': 'Grants Cart',
'EMAIL_ACCOUNT_VALIDATION': EMAIL_ACCOUNT_VALIDATION,
'disableZksync': disableZksync,
'disablePolygon': disablePolygon
}

if request.user.is_authenticated:
profile = request.user.profile
context['username'] = profile.username
Expand Down

0 comments on commit d18337c

Please sign in to comment.