Class: Thredded::PostPolicy::Scope

Inherits:
Object
  • Object
show all
Defined in:
app/policies/thredded/post_policy.rb

Overview

The scope of readable posts. MessageboardPolicy must be applied separately.

Instance Method Summary collapse

Constructor Details

#initialize(user, scope) ⇒ Scope

Returns a new instance of Scope.

Parameters:



10
11
12
13
# File 'app/policies/thredded/post_policy.rb', line 10

def initialize(user, scope)
  @user = user
  @scope = scope
end

Instance Method Details

#resolveActiveRecord::Relation<Thredded::Post>

Returns:



16
17
18
# File 'app/policies/thredded/post_policy.rb', line 16

def resolve
  @scope.moderation_state_visible_to_user(@user)
end