Merge pull request #5883 from SuperTux88/fix-camo-on-contacts-page
use camo for medium and small avatars
This commit is contained in:
commit
c95dd68545
3 changed files with 28 additions and 5 deletions
|
|
@ -10,6 +10,7 @@
|
||||||
* Destroy Participation when removing interactions with a post [#5852](https://github.com/diaspora/diaspora/pull/5852)
|
* Destroy Participation when removing interactions with a post [#5852](https://github.com/diaspora/diaspora/pull/5852)
|
||||||
* Hide manage services link in the publisher on certain pages [#5854](https://github.com/diaspora/diaspora/pull/5854)
|
* Hide manage services link in the publisher on certain pages [#5854](https://github.com/diaspora/diaspora/pull/5854)
|
||||||
* Fix notification mails for limited posts [#5877](https://github.com/diaspora/diaspora/pull/5877)
|
* Fix notification mails for limited posts [#5877](https://github.com/diaspora/diaspora/pull/5877)
|
||||||
|
* Fix medium and small avatar URLs when using Camo [#5883](https://github.com/diaspora/diaspora/pull/5883)
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
* Hide post title of limited post in comment notification email [#5843](https://github.com/diaspora/diaspora/pull/5843)
|
* Hide post title of limited post in comment notification email [#5843](https://github.com/diaspora/diaspora/pull/5843)
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
|
|
||||||
class AvatarPresenter < BasePresenter
|
class AvatarPresenter < BasePresenter
|
||||||
|
DEFAULT_IMAGE = ActionController::Base.helpers.image_path("user/default.png")
|
||||||
DEFAULT_IMAGE = ActionController::Base.helpers.image_path('user/default.png')
|
|
||||||
|
|
||||||
def base_hash
|
def base_hash
|
||||||
{ small: image_url_small || DEFAULT_IMAGE,
|
{
|
||||||
medium: image_url_medium || DEFAULT_IMAGE,
|
small: image_url(:thumb_small) || DEFAULT_IMAGE,
|
||||||
large: image_url || DEFAULT_IMAGE
|
medium: image_url(:thumb_medium) || DEFAULT_IMAGE,
|
||||||
|
large: image_url || DEFAULT_IMAGE
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
22
spec/presenters/avatar_presenter_spec.rb
Normal file
22
spec/presenters/avatar_presenter_spec.rb
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
require "spec_helper"
|
||||||
|
|
||||||
|
describe AvatarPresenter do
|
||||||
|
describe "#base_hash" do
|
||||||
|
it "calls image_url() for the avatars" do
|
||||||
|
@profile = FactoryGirl.create(:profile_with_image_url, person: alice.person)
|
||||||
|
@presenter = AvatarPresenter.new(@profile)
|
||||||
|
expect(@profile).to receive(:image_url).exactly(3).times
|
||||||
|
expect(@presenter.base_hash).to be_present
|
||||||
|
end
|
||||||
|
|
||||||
|
it "returns the default images if no images set" do
|
||||||
|
@profile = FactoryGirl.create(:profile, person: alice.person)
|
||||||
|
@presenter = AvatarPresenter.new(@profile)
|
||||||
|
expect(@presenter.base_hash).to eq(
|
||||||
|
small: "/assets/user/default.png",
|
||||||
|
medium: "/assets/user/default.png",
|
||||||
|
large: "/assets/user/default.png"
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Reference in a new issue