Browse files

Auto fetch gists at first login

  • Loading branch information...
1 parent 7deb30a commit 37de7a27fb5fe135700777e039c9d1def0c0070d @rwdaigle committed Oct 5, 2012
Showing with 6 additions and 1 deletion.
  1. +2 −1 app/controllers/sessions_controller.rb
  2. +4 −0 app/models/user.rb
View
3 app/controllers/sessions_controller.rb
@@ -12,7 +12,8 @@ def logout
def create
user = User.authenticate(request.env['omniauth.auth'])
log_in_user(user.id)
- redirect_to search_gists_path
log({ns: self.class, fn: __method__, measure: true, at: 'login'}, user)
+ QC.enqueue("GistFetcher.fetch_user", user.id) if !user.fetched?
+ redirect_to search_gists_path
end
end
View
4 app/models/user.rb
@@ -27,6 +27,10 @@ def authenticate(auth)
end
end
+ def fetched?
+ !last_gh_fetch.nil?
+ end
+
def to_log
{ user: gh_username, user_id: id, user_email: gh_email }
end

0 comments on commit 37de7a2

Please sign in to comment.