Class: Thredded::TopicPolicy::Scope

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

Overview

The scope of readable topics. 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/topic_policy.rb', line 10

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

Instance Method Details

#resolveActiveRecord::Relation<Thredded::Topic>

Returns:


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

def resolve
  @scope.moderation_state_visible_to_user(@user)
end