From 56405d67d5133e6376bb4139808f7f14510face8 Mon Sep 17 00:00:00 2001 From: Owocki Date: Sun, 11 Nov 2018 11:19:35 -0700 Subject: [PATCH] make fix --- app/assets/v2/js/metamask-approval.js | 8 ++++++-- app/assets/v2/js/shared.js | 4 +++- .../management/commands/pending_start_work_actions.py | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/assets/v2/js/metamask-approval.js b/app/assets/v2/js/metamask-approval.js index e98673e32c6..2ef3c1a1022 100644 --- a/app/assets/v2/js/metamask-approval.js +++ b/app/assets/v2/js/metamask-approval.js @@ -7,10 +7,12 @@ async function metamaskApproval() { try { if (is_metamask_unlocked && is_metamask_approved) { var start_time = ((new Date()).getTime() / 1000); + await ethereum.enable(); var now_time = ((new Date()).getTime() / 1000); var did_request_and_user_respond = (now_time - start_time) > 1.0; - if(did_request_and_user_respond){ + + if (did_request_and_user_respond) { document.location.href = document.location.href; } } @@ -26,10 +28,12 @@ window.addEventListener('load', metamaskApproval); async function approve_metamask() { try { var start_time = ((new Date()).getTime() / 1000); + await ethereum.enable(); var now_time = ((new Date()).getTime() / 1000); var did_request_and_user_respond = (now_time - start_time) > 1.0; - if(did_request_and_user_respond){ + + if (did_request_and_user_respond) { document.location.href = document.location.href; } is_metamask_approved = true; diff --git a/app/assets/v2/js/shared.js b/app/assets/v2/js/shared.js index da08618aac7..fe14144edf5 100644 --- a/app/assets/v2/js/shared.js +++ b/app/assets/v2/js/shared.js @@ -898,10 +898,12 @@ var listen_for_web3_changes = async function() { is_metamask_unlocked = await window.ethereum._metamask.isUnlocked(); if (is_metamask_approved && is_metamask_unlocked) { var start_time = ((new Date()).getTime() / 1000); + await ethereum.enable(); var now_time = ((new Date()).getTime() / 1000); var did_request_and_user_respond = (now_time - start_time) > 1.0; - if(did_request_and_user_respond){ + + if (did_request_and_user_respond) { document.location.href = document.location.href; } } diff --git a/app/marketing/management/commands/pending_start_work_actions.py b/app/marketing/management/commands/pending_start_work_actions.py index 8a0513bbee0..258529d1895 100644 --- a/app/marketing/management/commands/pending_start_work_actions.py +++ b/app/marketing/management/commands/pending_start_work_actions.py @@ -20,7 +20,7 @@ from django.core.management.base import BaseCommand from django.utils import timezone -from dashboard.models import Interest, Bounty +from dashboard.models import Bounty, Interest from dashboard.views import record_user_action from marketing.mails import start_work_applicant_about_to_expire, start_work_applicant_expired, start_work_approved