This repository has been archived by the owner on Feb 8, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rough in sending a confirmation email
- Loading branch information
1 parent
9e090cb
commit 11bfc72
Showing
5 changed files
with
71 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
Gratipay.packages = {}; | ||
|
||
Gratipay.packages.post = function(e) { | ||
e.preventDefault(); | ||
var $this = $(this); | ||
var action = 'add-email-and-claim-package'; | ||
var $inputs = $('input, button'); | ||
var $selection = $('input[name=email]:checked'); | ||
var address = $selection.val(); | ||
var package_id = $selection.parent().parent().data('package-id'); | ||
|
||
$inputs.prop('disabled', true); | ||
|
||
$.ajax({ | ||
url: '/~' + Gratipay.username + '/emails/modify.json', | ||
type: 'POST', | ||
data: {action: action, address: address, package_id: package_id}, | ||
dataType: 'json', | ||
success: function (msg) { | ||
if (msg) { | ||
Gratipay.notification(msg, 'success'); | ||
} | ||
if (action == 'add-email') { | ||
$('input.add-email').val(''); | ||
setTimeout(function(){ window.location.reload(); }, 3000); | ||
return; | ||
} | ||
$inputs.prop('disabled', false); | ||
}, | ||
error: [ | ||
function () { $inputs.prop('disabled', false); }, | ||
Gratipay.error | ||
], | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,12 +6,12 @@ | |
|
||
class Tests(BrowserHarness): | ||
|
||
def test_sending_a_confirmation_email_works(self): | ||
def test_sending_a_confirmation_email_appears_to_work(self): | ||
self.make_package() | ||
self.make_participant('alice', claimed_time='now') | ||
self.sign_in('alice') | ||
self.make_participant('bob', claimed_time='now') | ||
self.sign_in('bob') | ||
self.visit('/on/npm/foo/') | ||
self.css('input[type=radio]').click() | ||
self.css('button').click() | ||
self.css('input[type=radio]')[0].click() | ||
self.css('button')[0].click() | ||
assert self.has_element('.notification.notification-success', 1) | ||
assert self.has_text('A confirmation email has been sent') | ||
assert self.has_text('Check [email protected] for a confirmation email.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters