Stream 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/stream/fires.rb +20 -2
- data/stream.gemspec +1 -1
- metadata +1 -1
data/lib/stream/fires.rb
CHANGED
@@ -34,11 +34,29 @@ module Stream
|
|
34
34
|
create_options[:activity_type] = activity_type.to_s
|
35
35
|
|
36
36
|
transaction do
|
37
|
-
activity = ActivityItem.
|
37
|
+
activity = ActivityItem.new(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, :conditions => ["subject_type = ? AND subject_id = ? AND DATE(updated_at) = current_date",
|
46
|
+
photo.class,photo.id])
|
47
|
+
|
48
|
+
unless last_activity && (activity.subject.gallery.eql?(last_activity.subject.gallery))
|
49
|
+
([activity.actor] + gallery.allowed_contacts).each do |p|
|
50
|
+
activity.is_hidden = !p.subject.approval_status
|
51
|
+
activity.save
|
52
|
+
p.activity_items << activity
|
53
|
+
end
|
54
|
+
else
|
55
|
+
last_activity.photos << activity.subject
|
56
|
+
end
|
40
57
|
else
|
41
|
-
|
58
|
+
activity.save
|
59
|
+
([activity.actor] + activity.actor.contacts).each{|p| p.activity_items << activity }
|
42
60
|
end
|
43
61
|
end
|
44
62
|
end
|
data/stream.gemspec
CHANGED