Skip to content
Extraits de code Groupes Projets
Valider cc840515 rédigé par Raphael Sofaer's avatar Raphael Sofaer
Parcourir les fichiers

Fall back to author if the diaspora_handle isn't set, that column just needs to be removed

parent d22878f3
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -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
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter