Class: Thredded::PrivatePost

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
PostCommon
Defined in:
app/models/thredded/private_post.rb

Instance Method Summary collapse

Methods included from PostCommon

#avatar_url, #calculate_page, #filtered_content

Instance Method Details

#page(per_page: self.class.default_per_page) ⇒ Object

Parameters:

  • per_page (Integer) (defaults to: self.class.default_per_page)


22
23
24
# File 'app/models/thredded/private_post.rb', line 22

def page(per_page: self.class.default_per_page)
  calculate_page(postable.posts, per_page)
end

#private_topic_post?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'app/models/thredded/private_post.rb', line 26

def private_topic_post?
  true
end

#readers_from_user_names(user_names) ⇒ ActiveRecord::Relation<Thredded.user_class>

Returns users from the list of user names that can read this post.

Returns:

  • (ActiveRecord::Relation<Thredded.user_class>)

    users from the list of user names that can read this post.



31
32
33
34
35
# File 'app/models/thredded/private_post.rb', line 31

def readers_from_user_names(user_names)
  DbTextSearch::CaseInsensitive
    .new(postable.users, Thredded.user_name_column)
    .in(user_names)
end