here you go

This commit is contained in:
zhitomirskiyi 2011-01-17 18:03:15 -08:00
parent 3f21a05e3e
commit c28b5a22fb
5 changed files with 13 additions and 11 deletions

View file

@ -36,8 +36,8 @@ class Photo < Post
photo.image.store! image_file
unless photo.image.url.match(/^https?:\/\//)
pod_url = APP_CONFIG[:pod_url].dup
pod_url.chop! if APP_CONFIG[:pod_url][-1,1] == '/'
pod_url = AppConfig[:pod_url].dup
pod_url.chop! if AppConfig[:pod_url][-1,1] == '/'
remote_path = "#{pod_url}#{photo.image.url}"
else
remote_path = photo.image.url
@ -60,7 +60,7 @@ class Photo < Post
end
def ensure_user_picture
profiles = Profile.where(:image_url => absolute_url(:thumb_large))
profiles = Profile.where(:image_url => url(:thumb_large))
profiles.each { |profile|
profile.image_url = nil
profile.save

View file

@ -75,7 +75,7 @@ class Post < ActiveRecord::Base
known_post = user.visible_posts(:guid => self.guid).first
if known_post
if known_post.mutable?
known_post.save_update(self)
known_post.update_attributes(self.attributes)
else
Rails.logger.info("event=receive payload_type=#{self.class} update=true status=abort sender=#{self.diaspora_handle} reason=immutable existing_post=#{known_post.id}")
end

View file

@ -50,7 +50,7 @@ describe 'migrations' do
photo.url.match(/$http.*jpg^/)
end
@photos[0].remote_photo_path.should include("http://google-")
@photos[0].remote_photo_path.should include("http")
@photos[1].remote_photo_path.should include("https://remote.com/")
end

View file

@ -56,7 +56,7 @@ describe Photo do
end
it 'sets a remote url' do
image = File.open(@fixture_name)
photo = Photo.instantiate(
photo = Photo.diaspora_initialize(
:person => @user.person, :user_file => image)
photo.remote_photo_path.should include("http")
photo.remote_photo_name.should include(".png")

View file

@ -52,16 +52,18 @@ describe Profile do
lambda {@profile.image_url = ""}.should_not change(@profile, :image_url)
end
it 'makes relative urls absolute' do
@profile.image_url = @photo.url(:thumb_large)
@profile.image_url.should == @photo.url(:thumb_large)
@profile.image_url = "/relative/url"
@profile.image_url.should == "#{@pod_url}/relative/url"
end
it "doesn't change absolute urls" do
@profile.image_url = "http://not/a/relative/url"
@profile.image_url.should == "http://not/a/relative/url"
end
end
describe 'serialization' do
let(:person) {Factory.create(:person)}
let(:person) {Factory.create(:person,:diaspora_handle => "foobar" )}
it 'should include persons diaspora handle' do
xml = person.profile.to_diaspora_xml
xml = person.profile.to_diaspora_xml
xml.should include "foobar"
end