Class: Thredded::PrivateTopicsPageView

Inherits:
Object
  • Object
show all
Defined in:
app/view_models/thredded/private_topics_page_view.rb

Overview

A view model for a page of BaseTopicViews.

Instance Method Summary collapse

Constructor Details

#initialize(user, topics_page_scope) ⇒ PrivateTopicsPageView

Returns a new instance of PrivateTopicsPageView.

Parameters:



18
19
20
21
22
23
# File 'app/view_models/thredded/private_topics_page_view.rb', line 18

def initialize(user, topics_page_scope)
  @topics_page_scope = refine_scope(topics_page_scope)
  @topic_views = @topics_page_scope.with_read_states(user).map do |(topic, read_state)|
    Thredded::PrivateTopicView.new(topic, read_state, Pundit.policy!(user, topic))
  end
end