Permalink
Browse files

Make PublicActivity optional, not loaded for Ruby 1.8.

  • Loading branch information...
1 parent 46ae078 commit 49f6a96906b815c0a823e218b93a586318422ce8 @bamnet bamnet committed Mar 21, 2013
View
@@ -1,5 +1,5 @@
rvm:
-# - 1.8.7 # Only disabled until we resolve the public activity situation.
+ - 1.8.7
- 1.9.2
- 2.0.0
View
@@ -67,7 +67,8 @@ gem 'strong_parameters'
gem 'kaminari' # Pagination
-gem 'public_activity' #Newsfeed
+# Enable the newsfeed for 1.9+ users.
+gem 'public_activity' if RUBY_VERSION >= "1.9"
# Default content type plugins.
gem 'concerto_simple_rss'
@@ -75,6 +75,7 @@ def switch_to_main_app_ability
#pa_params - specifically params send to PA to be stored in the params column on the activities
#options - right now it only contains the action being performed (CRUD), but anything we don't want to send to PA can go here
def process_notification(ar_instance, pa_params, options = {})
+ return if ar_instance.nil? || !ar_instance.respond_to?('create_activity')
activity = ar_instance.create_activity(options[:action], :owner => options[:owner], :recipient => options[:recipient], :params => pa_params)
#form the actionmailer method name by combining the class name with the action being performed (e.g. "submission_update")
am_string = "#{ar_instance.class.name.downcase}_#{options[:action]}"
@@ -23,7 +23,7 @@ def parent_id_cannot_be_this_content
end
#Newsfeed
- include PublicActivity::Common
+ include PublicActivity::Common if defined? PublicActivity::Common
belongs_to :parent, :class_name => "Content"
has_many :children, :class_name => "Content", :foreign_key => "parent_id"
View
@@ -18,7 +18,7 @@ class Feed < ActiveRecord::Base
validate :parent_id_cannot_be_this_feed
#Newsfeed
- include PublicActivity::Common
+ include PublicActivity::Common if defined? PublicActivity::Common
def parent_id_cannot_be_this_feed
if !parent_id.blank? and parent_id == id
View
@@ -22,7 +22,7 @@ class Group < ActiveRecord::Base
before_save :update_membership_perms
#Newsfeed
- include PublicActivity::Common
+ include PublicActivity::Common if defined? PublicActivity::Common
#have getters and setters for a new_leader virtual attribute
attr_accessor :new_leader
@@ -37,7 +37,7 @@ class Membership < ActiveRecord::Base
belongs_to :group
#Newsfeed
- include PublicActivity::Common
+ include PublicActivity::Common if defined? PublicActivity::Common
# Validations
validates :user, :presence => true, :associated => true
@@ -20,7 +20,7 @@ class Screen < ActiveRecord::Base
validates :owner, :presence => true, :associated => true, :if => Proc.new { ["User", "Group"].include?(owner_type) }
#Newsfeed
- include PublicActivity::Common
+ include PublicActivity::Common if defined? PublicActivity::Common
# Scopes
ONLINE_THRESHOLD = 5.minutes
@@ -23,7 +23,7 @@ class Submission < ActiveRecord::Base
scope :future, joins(:content).merge(Content.future)
#Newsfeed
- include PublicActivity::Common
+ include PublicActivity::Common if defined? PublicActivity::Common
def moderation_text
case self.moderation_flag

0 comments on commit 49f6a96

Please sign in to comment.