Class: Thredded::PrivateTopicView
- Inherits:
-
BaseTopicView
- Object
- BaseTopicView
- Thredded::PrivateTopicView
- Defined in:
- app/view_models/thredded/private_topic_view.rb
Overview
A view model for PrivateTopic.
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from BaseTopicView
#can_destroy?, #can_update?, #initialize, #path, #states
Constructor Details
This class inherits a constructor from Thredded::BaseTopicView
Class Method Details
.from_user(topic, user) ⇒ Object
12 13 14 15 16 17 18 |
# File 'app/view_models/thredded/private_topic_view.rb', line 12 def self.from_user(topic, user) read_state = if user && !user.thredded_anonymous? Thredded::UserPrivateTopicReadState .find_by(user_id: user.id, postable_id: topic.id) end new(topic, read_state, Pundit.policy!(user, topic)) end |
Instance Method Details
#edit_path ⇒ Object
8 9 10 |
# File 'app/view_models/thredded/private_topic_view.rb', line 8 def edit_path Thredded::UrlsHelper.edit_private_topic_path(@topic) end |