Fall back to author if the diaspora_handle isn't set, that column just needs to be removed
This commit is contained in:
parent
d22878f3f0
commit
cc84051541
2 changed files with 12 additions and 3 deletions
|
|
@ -29,6 +29,9 @@ class Post < ActiveRecord::Base
|
|||
cattr_reader :per_page
|
||||
@@per_page = 10
|
||||
|
||||
def diaspora_handle
|
||||
read_attribute(:diaspora_handle) || self.author.diaspora_handle
|
||||
end
|
||||
def user_refs
|
||||
if AspectVisibility.exists?(:post_id => self.id)
|
||||
self.post_visibilities.count + 1
|
||||
|
|
|
|||
|
|
@ -27,10 +27,16 @@ JSON
|
|||
end
|
||||
|
||||
describe 'serialization' do
|
||||
before do
|
||||
@photo = Factory(:activity_streams_photo)
|
||||
xml = @photo.to_diaspora_xml.to_s
|
||||
@marshalled = Diaspora::Parser.from_xml(xml)
|
||||
end
|
||||
it 'Diaspora::Parser should pick the right class' do
|
||||
photo = Factory(:activity_streams_photo)
|
||||
xml = photo.to_diaspora_xml.to_s
|
||||
Diaspora::Parser.from_xml(xml).class.should == ActivityStreams::Photo
|
||||
@marshalled.class.should == ActivityStreams::Photo
|
||||
end
|
||||
it 'marshals the author' do
|
||||
@marshalled.author.should == @photo.author
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue