Class: Thredded::PostModerationRecord

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.record!(moderator:, post:, previous_moderation_state:, moderation_state:) ⇒ Thredded::PostModerationRecord

Returns the newly created persisted record.

Parameters:

Returns:



63
64
65
66
67
68
69
70
71
72
73
74
# File 'app/models/thredded/post_moderation_record.rb', line 63

def self.record!(moderator:, post:, previous_moderation_state:, moderation_state:)
  create!(
    previous_moderation_state: previous_moderation_state,
    moderation_state:          moderation_state,
    moderator:                 moderator,
    post:                      post,
    post_content:              post.content,
    post_user:                 post.user,
    post_user_name:            post.user.try(:thredded_display_name),
    messageboard_id:           post.messageboard_id,
  )
end

Instance Method Details

#post_readersActiveRecord::Relation<Thredded.user_class>

Returns users that can read the moderated post.

Returns:

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

    users that can read the moderated post.



54
55
56
# File 'app/models/thredded/post_moderation_record.rb', line 54

def post_readers
  Thredded.user_class.thredded_messageboards_readers([messageboard])
end