Skip to content
This repository has been archived by the owner on Sep 19, 2021. It is now read-only.

Commit

Permalink
Fixed broken user images
Browse files Browse the repository at this point in the history
  • Loading branch information
gornostal committed Jan 19, 2014
1 parent 98fa11b commit fd124a8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions index.py
Expand Up @@ -106,7 +106,8 @@ def oauth_authorized(resp):
user_info = twitter.get('users/show.json', data={'screen_name': resp['screen_name']})
user_info = user_info.data
user["full_name"] = user_info['name']
mongo.db.users.update({"user_id" : user["user_id"]}, user)
user["profile_image_url"] = user_info['profile_image_url']
mongo.db.users.update({"user_id": user["user_id"]}, user)
session['user_id'] = user["user_id"]
session.permanent = True

Expand Down Expand Up @@ -172,7 +173,11 @@ def api_comments(sitehash):
mongo.db.kitty.insert(checkin)
checkin['comments'].insert(0, {
"text": text,
"author": {"login": g.user['name'], "name": g.user['full_name'] or g.user['name']},
"author": {
"login": g.user['name'],
"name": g.user.get('full_name') or g.user['name'],
"profile_image_url": g.user.get('profile_image_url')
},
"datetime": str(time.mktime(datetime.now().timetuple()))
})
mongo.db.kitty.update({'sitehash': sitehash}, checkin)
Expand Down
2 changes: 1 addition & 1 deletion views/index.html
Expand Up @@ -38,7 +38,7 @@
<div class="comment">
<div class="header">
<a href="https://twitter.com/<%= author.login %>" target="_blank" class="account">
<img src="https://api.twitter.com/1/users/profile_image?screen_name=<%= author.login %>&size=normal"
<img src="<%= author.profile_image_url || 'http://a0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png' %>"
alt="<%= author.login %>" class="avatar" />
<strong class="fullname"><%= author.name %></strong>
<span class="username">
Expand Down

0 comments on commit fd124a8

Please sign in to comment.