Sha256: b552ffc119f1d20e2535fb02845093ad9aec298d350208de7501088ad15fbf58
Contents?: true
Size: 563 Bytes
Versions: 5
Compression:
Stored size: 563 Bytes
Contents
# frozen_string_literal: true module Thredded # A view model for PrivateTopic. class PrivateTopicView < Thredded::BaseTopicView delegate :users, to: :@topic def edit_path Thredded::UrlsHelper.edit_private_topic_path(@topic) end def self.from_user(topic, user) read_state = if user && !user.thredded_anonymous? UserPrivateTopicReadState .find_by(user_id: user.id, postable_id: topic.id) end new(topic, read_state, Pundit.policy!(user, topic)) end end end
Version data entries
5 entries across 5 versions & 1 rubygems