Skip to content
Extraits de code Groupes Projets
Valider f85a047f rédigé par Maxwell Salzberg's avatar Maxwell Salzberg
Parcourir les fichiers

MS DG; for real this time?

parent cde12ec2
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -111,7 +111,7 @@ module Diaspora ...@@ -111,7 +111,7 @@ module Diaspora
def participants def participants
@participants ||= lambda do @participants ||= lambda do
share_type = self.class.base_class.to_s share_type = self.class.base_class.to_s
people = [self.author] people = []
if self.respond_to? :comments if self.respond_to? :comments
people += Person.joins(:comments).where(:comments => {:commentable_id => self.id, :commentable_type => share_type}).all people += Person.joins(:comments).where(:comments => {:commentable_id => self.id, :commentable_type => share_type}).all
end end
......
...@@ -196,17 +196,12 @@ describe Post do ...@@ -196,17 +196,12 @@ describe Post do
end end
describe '#participants' do describe '#participants' do
it 'includes the post author' do
status = Factory(:status_message, :author => bob.person, :public => true)
status.participants.map(&:id).should == [bob.person.id]
end
it 'only returns the people that commented and liked the post' do it 'only returns the people that commented and liked the post' do
status = Factory(:status_message, :author => bob.person, :public => true) status = Factory(:status_message, :author => bob.person, :public => true)
alice.comment('too', :post => status) alice.comment('too', :post => status)
eve.like(true, :target => status) eve.like(true, :target => status)
status.participants.map(&:id).should =~ [alice, eve, bob].map{|x| x.person.id} status.participants.map(&:id).should =~ [alice, eve].map{|x| x.person.id}
end 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