Sha256: 2f6a59f014dad7daaf6b6f08907d40e485a40b6c61f73157a25945d16caa4f8e
Contents?: true
Size: 827 Bytes
Versions: 9
Compression:
Stored size: 827 Bytes
Contents
# frozen_string_literal: true require_dependency 'thredded/private_topic_view' module Thredded # A view model for a page of BaseTopicViews. class PrivateTopicsPageView delegate :to_ary, :blank?, :empty?, to: :@topic_views delegate :total_pages, :current_page, :limit_value, to: :@topics_page_scope # @param user [Thredded.user_class] the user who is viewing the posts page # @param topics_page_scope [ActiveRecord::Relation<Thredded::Topic>] def initialize(user, topics_page_scope) @topics_page_scope = topics_page_scope @topic_views = @topics_page_scope.with_read_states(user).map do |(topic, read_state)| PrivateTopicView.new(topic, read_state, Pundit.policy!(user, topic)) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems