Skip to content

Commit

Permalink
FIX: don't update gravatar if the user has no email
Browse files Browse the repository at this point in the history
  • Loading branch information
ZogStriP committed Feb 20, 2019
1 parent cc1f9e7 commit e3a2311
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/jobs/regular/update_gravatar.rb
Expand Up @@ -8,7 +8,7 @@ def execute(args)
user = User.find_by(id: args[:user_id])
avatar = UserAvatar.find_by(id: args[:avatar_id])

if user && avatar && avatar.user&.id == user.id
if user && avatar && avatar.user&.id == user.id && user.email.present?
avatar.update_gravatar!
if !user.uploaded_avatar_id && avatar.gravatar_upload_id
user.update_column(:uploaded_avatar_id, avatar.gravatar_upload_id)
Expand Down

3 comments on commit e3a2311

@tgxworld
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a test for this?

@davidtaylorhq
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would we end up with a user without an email address? I think we make this same assumption in many parts of the application?

@SamSaffron
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its so rare, I am not sure we need to carry a test here for this huge level of strange.

Please sign in to comment.