upcoming / upcoming-www

Upcoming.org Site
Apache License 2.0
168 stars 17 forks source link

profile_image_url vs avatar_image_url #42

Open revdancatt opened 7 years ago

revdancatt commented 7 years ago

The db schema has user with a profile_image_url field which is set in passport.js when the user logs in with twitter. However, when the user does login the code also tries to UPDATE the user record with avatar_image_url which fails and crashes the app.

Line 65 helpers/index.js db.query('UPDATE user SET avatar_image_url = ? WHERE id = ?', [res.req.url, user.id], function (err, result) {...stuff....})

In the template layout.jade we can see the following lines...

if user.avatar_image_url
    img.img-rounded(alt='', src="#{user.avatar_image_url}", width='30', height='30')
else
    img.img-rounded(alt='', src="#{user.profile_image_url}", width='30', height='30')

...where it shows that either one or the other is possible (and expected). Meanwhile, most of the rest of the templates are expecting user.avatar_image_url.

Is the user db scheme correct?