Skip to content

Commit

Permalink
Adds metamask check in grant form (#2487)
Browse files Browse the repository at this point in the history
  • Loading branch information
SaptakS authored and Mark Beacom committed Oct 18, 2018
1 parent 6156d98 commit 99436c9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/assets/v2/js/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,7 @@ var trigger_primary_form_web3_hooks = function() {

if ($('#primary_form').length) {
var is_zero_balance_not_okay = document.location.href.indexOf('/faucet') == -1;
var unlock_metamask_error = web3.eth.coinbase ? web3.eth.coinbase : web3.eth.getCoinbase();

This comment has been minimized.

Copy link
@captnseagraves

captnseagraves Oct 18, 2018

Contributor

web3.eth.getCoinbase() returns a promise. This ternary will always return false and won't receive a response without a callback.


if (typeof web3 == 'undefined') {
$('#no_metamask_error').css('display', 'block');
Expand All @@ -722,7 +723,7 @@ var trigger_primary_form_web3_hooks = function() {
$('#unlock_metamask_error').css('display', 'none');
$('#no_issue_error').css('display', 'none');
mixpanel_track_once('No Metamask Error', params);
} else if (!web3.eth.coinbase) {
} else if (!unlock_metamask_error) {
$('#unlock_metamask_error').css('display', 'block');
$('#zero_balance_error').css('display', 'none');
$('#no_metamask_error').css('display', 'none');
Expand Down
12 changes: 11 additions & 1 deletion app/grants/templates/grants/new.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
{% include 'shared/tag_manager_2.html' %}
<div class="container-fluid header dash">
{% include 'shared/nav.html' %}
<div class="row no-gutters metamask-banner">
<div class="col-12">
{% include 'shared/no_metamask_error.html' %}
{% include 'shared/zero_balance_error.html' %}
{% include 'shared/unlock_metamask.html' %}
</div>
</div>
</div>

<div class="row no-gutter grant_waiting" style="display: none;">
Expand All @@ -46,7 +53,10 @@

<div class="container new-grant" id="new-grant">
<div class="row justify-content-md-center">
<div class="col-sm-12 col-md-10 col-lg-6">
<div id="robot_error" class="hidden">
<img src="{% static "v2/images/prime.png" %}">
</div>
<div class="col-sm-12 col-md-10 col-lg-6" id="primary_form">
<div class="form__intro text-center">
<h1>{% trans "Create a Grant" %}</h1>
<p>{% trans "We're excited to learn about your project. Complete the form below to get funding for your project." %}</p>
Expand Down

0 comments on commit 99436c9

Please sign in to comment.