module SocialStream::Controllers::Objects

Constants

COMMON_PARAMS

Protected Instance Methods

activity_object_property_params() click to toggle source
# File lib/social_stream/controllers/objects.rb, line 82
def activity_object_property_params
  SocialStream.objects.map do |o|
    "add_holder_#{ o }_id".to_sym
  end
end
all_allowed_params() click to toggle source
# File lib/social_stream/controllers/objects.rb, line 92
def all_allowed_params
  COMMON_PARAMS  |
    activity_object_property_params |
    allowed_params
end
allowed_params() click to toggle source
# File lib/social_stream/controllers/objects.rb, line 88
def allowed_params
  [] # This should be overriden in controllers to allow extra params
end
collection_variable_get() click to toggle source
# File lib/social_stream/controllers/objects.rb, line 74
def collection_variable_get
  instance_variable_get "@#{ controller_name }"
end
collection_variable_set(value) click to toggle source
# File lib/social_stream/controllers/objects.rb, line 78
def collection_variable_set value
  instance_variable_set "@#{ controller_name }", value
end
increment_visit_count() click to toggle source
# File lib/social_stream/controllers/objects.rb, line 70
def increment_visit_count
  resource.activity_object.increment!(:visit_count) if request.format == 'html'
end
set_post_activity() click to toggle source
# File lib/social_stream/controllers/objects.rb, line 98
def set_post_activity
  @post_activity = resource.post_activity
end

Private Instance Methods

search_options() click to toggle source
# File lib/social_stream/controllers/objects.rb, line 104
def search_options
  opts = search_scope_options

  # profile_subject
  if profile_subject.present?
    opts.deep_merge!( { :with => { :owner_id => profile_subject.actor_id } } )
  end

  # Authentication
  opts.deep_merge!({ :with => { :relation_ids => Relation.ids_shared_with(current_subject) } } )

  # Pagination
  opts.merge!({
    :order => :created_at,
    :sort_mode => :desc,
    :per_page => params[:per_page] || self.class.model_class.default_per_page,
    :page => params[:page]
  })

  opts
end
search_scope_options() click to toggle source
# File lib/social_stream/controllers/objects.rb, line 126
def search_scope_options
  if params[:scope].blank? || ! user_signed_in?
    return {}
  end

  case params[:scope]
  when "me"
    { :with => { :author_id => [ current_subject.author_id ] } }
  when "net"
    { :with => { :author_id => current_subject.following_actor_and_self_ids } }
  when "other"
    { :without => { :author_id => current_subject.following_actor_and_self_ids } }
  else
    raise "Unknown search scope #{ params[:scope] }"
  end
end