Mercurial > pumpbridge
diff src/google.coffee @ 4:f352c74a6a5b
remove typeof, corrected facebooks toESN entrys
author | Mathias Gebbe <mgebbe@intevation.de> |
---|---|
date | Fri, 06 Jun 2014 10:18:14 +0200 |
parents | 98a070c98982 |
children | 2123f355ab68 |
line wrap: on
line diff
--- a/src/google.coffee Thu Jun 05 18:02:25 2014 +0200 +++ b/src/google.coffee Fri Jun 06 10:18:14 2014 +0200 @@ -103,7 +103,7 @@ res.on "end", () -> user = JSON.parse(data) - Routes.updateUserDB(user.id+'@google',user.displayName,user.displayName,user.url,user.image.url) unless typeof user.id is "undefined" + Routes.updateUserDB(user.id+'@google',user.displayName,user.displayName,user.url,user.image.url) if user.id? ).on "error", (e) -> console.log "Got error: " + e.message @@ -115,7 +115,7 @@ ###### get google friends ###### ####################################### getFriends = (user, callback) -> - return if typeof user is "undefined" + return if not user? data = "" friends = new Array() me = user.user_pumpio @@ -145,9 +145,10 @@ (users, callback) -> EdgeControl.removeEdges(me,'@google') _.each users.items, (user) -> - friends.push(user.id) - Routes.updateUserDB(user.id+'@google',user.displayName,user.displayName,user.url,user.image.url) unless typeof user.id is "undefined" - EdgeControl.addEdge(me,user.id+'@google') unless typeof user.id is "undefined" + if user.id? + friends.push(user.id) + Routes.updateUserDB(user.id+'@google',user.displayName,user.displayName,user.url,user.image.url) + EdgeControl.addEdge(me,user.id+'@google') callback null, friends ], (err, friends) -> callback null, friends