Stream 0.1.16 → 0.1.18
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/stream/fires.rb +1 -19
- data/stream.gemspec +1 -1
- metadata +1 -1
data/lib/stream/fires.rb
CHANGED
@@ -34,28 +34,10 @@ module Stream
|
|
34
34
|
create_options[:activity_type] = activity_type.to_s
|
35
35
|
|
36
36
|
transaction do
|
37
|
-
activity = ActivityItem.
|
37
|
+
activity = ActivityItem.create!(create_options)
|
38
38
|
if activity_type.to_s.eql?'new_message'
|
39
39
|
activity.subject.recipient.activity_items << activity
|
40
|
-
elsif activity_type.to_s.eql?'new_photo'
|
41
|
-
|
42
|
-
gallery = activity.subject.gallery
|
43
|
-
photo = activity.subject
|
44
|
-
# Find recent photo activity
|
45
|
-
last_activity = ActivityItem.find(:first,
|
46
|
-
:conditions => ["subject_type = ? AND photos.gallery_id = ? AND DATE(activity_items.updated_at) = current_date",
|
47
|
-
activity.subject.class,gallery.id],:include=>[:photos])
|
48
|
-
|
49
|
-
unless last_activity && (gallery.eql?(last_activity.subject.gallery))
|
50
|
-
([activity.actor] + gallery.allowed_contacts).each do |p|
|
51
|
-
activity.is_hidden = activity.subject.approval_status==true ? true : false
|
52
|
-
activity.photos << activity.subject
|
53
|
-
activity.save
|
54
|
-
p.activity_items << activity
|
55
|
-
end
|
56
|
-
end
|
57
40
|
else
|
58
|
-
activity.save
|
59
41
|
([activity.actor] + activity.actor.contacts).each{|p| p.activity_items << activity }
|
60
42
|
end
|
61
43
|
end
|
data/stream.gemspec
CHANGED