public
Fork of insoshi/insoshi
Description: The open source social networking platform in Ruby on Rails from the author of RailsSpace
Homepage: http://insoshi.com
Clone URL: git://github.com/trentono/insoshi.git
Fixed feed activity creation bugs (and failing specs!  Mea maxima culpa!).
Michael Hartl (author)
Mon Apr 28 17:16:32 -0700 2008
commit  ed848ffe459c9963dac4af4d2e2f441dc0b01a7c
tree    01b6f716468e7d33405f13fdef02c4af3dd25811
parent  daeb1572b3cc05d7e0b51f71f44f74498aa4865f
...
57
58
59
60
 
 
61
62
63
...
57
58
59
 
60
61
62
63
64
0
@@ -57,7 +57,8 @@ class Comment < ActiveRecord::Base
0
       activity = Activity.create!(:item => self, :person => commenter)
0
       add_activities(:activity => activity, :person => commenter)
0
       unless commented_person.nil?
0
- add_activities(:activity => activity, :person => commented_person)
0
+ add_activities(:activity => activity, :person => commented_person,
0
+ :include_person => true)
0
       end
0
     end
0
 end
...
1
2
3
 
4
5
6
 
7
8
9
...
1
2
3
4
5
6
7
8
9
10
11
0
@@ -1,8 +1,10 @@
0
 module ActivityLogger
0
   def add_activities(options = {})
0
     person = options[:person]
0
+ include_person = options[:include_person]
0
     activity = options[:activity] ||
0
                Activity.create!(:item => options[:item], :person => person)
0
     person.contacts.each { |c| c.activities << activity }
0
+ person.activities << activity if include_person
0
   end
0
 end
0
\ No newline at end of file
...
40
41
42
43
 
44
45
46
...
40
41
42
 
43
44
45
46
0
@@ -40,7 +40,7 @@ describe BlogPost do
0
     end
0
     
0
     it "should add an activity to the poster" do
0
- @post.blog.person.activities.include?(@activity).should == true
0
+ @post.blog.person.recent_activity.include?(@activity).should == true
0
     end
0
   end
0
   
...
46
47
48
49
 
50
51
52
...
46
47
48
 
49
50
51
52
0
@@ -46,7 +46,7 @@ describe Comment do
0
       end
0
 
0
       it "should add an activity to the commenter" do
0
- @comment.commenter.activities.include?(@activity).should == true
0
+ @comment.commenter.recent_activity.include?(@activity).should == true
0
       end
0
     end
0
   end
...
33
34
35
36
 
37
38
39
...
33
34
35
 
36
37
38
39
0
@@ -33,7 +33,7 @@ describe ForumPost do
0
     end
0
     
0
     it "should add an activity to the poster" do
0
- @post.person.activities.include?(@activity).should == true
0
+ @post.person.recent_activity.include?(@activity).should == true
0
     end
0
   end
0
 end

Comments

    No one has commented yet.