Module: Thredded::ContentModerationState Private
- Extended by:
- ActiveSupport::Concern
- Includes:
- ModerationState
- Defined in:
- app/models/concerns/thredded/content_moderation_state.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Moderation state of a piece of content, such as a Thredded::Topic or a Thredded::Post. Requires an integer moderation_state column, a user_id column, and a user_detail association on the including class.
Instance Method Summary collapse
-
#moderation_state_visible_to_all? ⇒ Boolean
private
Whether this is visible to anyone based on the moderation state.
-
#moderation_state_visible_to_user?(user) ⇒ Boolean
private
Whether this is visible to the given user based on the moderation state.
Instance Method Details
#moderation_state_visible_to_all? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Whether this is visible to anyone based on the moderation state.
46 47 48 49 50 51 52 |
# File 'app/models/concerns/thredded/content_moderation_state.rb', line 46 def moderation_state_visible_to_all? if Thredded.content_visible_while_pending_moderation !blocked? else approved? end end |
#moderation_state_visible_to_user?(user) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Whether this is visible to the given user based on the moderation state.
55 56 57 58 59 |
# File 'app/models/concerns/thredded/content_moderation_state.rb', line 55 def moderation_state_visible_to_user?(user) moderation_state_visible_to_all? || (!user.thredded_anonymous? && (user_id == user.id || user..map(&:id).include?())) end |