Skip to content

Commit

Permalink
Merge pull request #6562 from CartoDB/avatar_fix
Browse files Browse the repository at this point in the history
fixes avatar urls, now they can point to an absolute url or a local url.
  • Loading branch information
javisantana committed Feb 11, 2016
2 parents 5a456a2 + 4426c73 commit 0c4ca42
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ def reload_avatar
# If the user doesn't have gravatar try to get a cartodb avatar
if self.avatar_url.nil? || self.avatar_url == "//#{default_avatar}"
# Only update the avatar if the user avatar is nil or the default image
self.avatar_url = "//#{cartodb_avatar}"
self.avatar_url = "#{cartodb_avatar}"
self.this.update avatar_url: self.avatar_url
end
end
Expand All @@ -638,7 +638,7 @@ def avatar
end

def default_avatar
return "cartodb.s3.amazonaws.com/static/public_dashboard_default_avatar.png"
"/assets/unversioned/images/avatars/public_dashboard_default_avatar.png"
end

def gravatar(protocol = "http://", size = 128, default_image = default_avatar)
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/shared/_dashboard_header.erb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

<li class="Header-settingsItem Header-settingsItem--avatar">
<button class="UserAvatar js-settings-dropdown">
<%= image_tag current_user.avatar, :class => 'UserAvatar-img UserAvatar-img--medium' %>
<img src="<%= current_user.avatar %>" class='UserAvatar-img UserAvatar-img--medium' />
</button>
</li>
</ul>
Expand Down
4 changes: 2 additions & 2 deletions app/views/admin/shared/_private_header.erb
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
<% end %>
<li class="Header-settingsItem Header-settingsItem--avatar">
<button class="UserAvatar js-settings-dropdown">
<%= image_tag current_user.avatar, :class => 'UserAvatar-img UserAvatar-img--medium' %>
<img src="<%= current_user.avatar %>" class='UserAvatar-img UserAvatar-img--medium' />
</button>
</li>
</ul>
</div>
</div>
</div>
</div>
8 changes: 8 additions & 0 deletions lib/build/tasks/copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,14 @@
dest: '<%= assets_dir %>/images/'
},

// avatars should be placed in a unversioned folder
{
expand: true,
cwd: "app/assets/images/avatars/",
src: ['**/*'],
dest: '<%= root_assets_dir %>/unversioned/images/avatars/'
},

// CartoDB.js images

{
Expand Down

0 comments on commit 0c4ca42

Please sign in to comment.