Class: Thredded::Post
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Thredded::Post
- Includes:
- ContentModerationState, PostCommon
- Defined in:
- app/models/thredded/post.rb
Instance Method Summary collapse
- #page(per_page: self.class.default_per_page, user:) ⇒ Object
- #private_topic_post? ⇒ Boolean
-
#readers_from_user_names(user_names) ⇒ ActiveRecord::Relation<Thredded.user_class>
Users from the list of user names that can read this post.
Methods included from ContentModerationState
#moderation_state_visible_to_all?, #moderation_state_visible_to_user?
Methods included from PostCommon
#avatar_url, #calculate_page, #filtered_content
Instance Method Details
#page(per_page: self.class.default_per_page, user:) ⇒ Object
36 37 38 39 |
# File 'app/models/thredded/post.rb', line 36 def page(per_page: self.class.default_per_page, user:) readable_posts = PostPolicy::Scope.new(user, postable.posts).resolve calculate_page(readable_posts, per_page) end |
#private_topic_post? ⇒ Boolean
41 42 43 |
# File 'app/models/thredded/post.rb', line 41 def private_topic_post? false 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.
46 47 48 49 50 |
# File 'app/models/thredded/post.rb', line 46 def readers_from_user_names(user_names) DbTextSearch::CaseInsensitive .new(Thredded.user_class.([]), Thredded.user_name_column) .in(user_names) end |