diaspora/lib/stream/public_stream.rb
Your Name 55ffc44a42 wip
2011-10-06 17:13:04 -07:00

33 lines
795 B
Ruby

# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class PublicStream < BaseStream
def link(opts={})
Rails.application.routes.url_helpers.public_stream_path(opts)
end
def title
I18n.translate("streams.public.title")
end
# @return [ActiveRecord::Association<Post>] AR association of posts
def posts
@posts ||= Post.all_public.for_a_stream(max_time, order)
end
# @return [ActiveRecord::Association<Person>] AR association of people within stream's given aspects
def people
@people ||= posts.map{|p| p.author}.uniq
end
def contacts_title
"The last 15 people in this stream"
end
def can_comment?(post)
post.author.local?
end
end