Permalink
Browse files

always send the push URL

  • Loading branch information...
1 parent 694394b commit 3331e1d572b3bc76f8ae9b634f490e03fd8c4b62 Jeff Balogh committed Apr 2, 2012
Showing with 6 additions and 2 deletions.
  1. +3 −1 app.py
  2. +3 −1 static/app.js
View
@@ -68,11 +68,13 @@ def add_queue():
queue = request.form['queue']
username = session['username']
user = User.query.filter_by(username=username).first_or_404()
+ new_user = user.push_url is None
if user.push_url != queue:
- print 'Adding a new queue.'
+ print ('Adding push URL.' if new_user else 'Updating push URL.')
user.push_url = queue
db.session.add(user)
db.session.commit()
+ if new_user:
notify(queue, 'Welcome to Github Notifications!',
'So glad to have you %s.' % user.username)
return ''
View
@@ -214,7 +214,6 @@ function step3() {
if (cookies.username && cookies.access_token) {
token = localStorage.token = cookies.access_token;
username = localStorage.username = cookies.username;
- $.post('/queue', {queue: pushUrl});
// Clear the token and username.
var date = new Date();
@@ -228,6 +227,9 @@ function step3() {
username = localStorage.username;
promise.resolve();
}
+ promise.done(function() {
+ $.post('/queue', {queue: pushUrl});
+ });
return promise;
}

0 comments on commit 3331e1d

Please sign in to comment.