Module: Course::Forum::TopicControllerSubscriptionConcern

Extended by:
ActiveSupport::Concern
Included in:
TopicsController
Defined in:
app/controllers/concerns/course/forum/topic_controller_subscription_concern.rb

Instance Method Summary collapse

Instance Method Details

#subscribeObject


5
6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/concerns/course/forum/topic_controller_subscription_concern.rb', line 5

def subscribe
  authorize!(:read, @topic)

  if set_subscription_state
    redirect_to course_forum_topic_path(current_course, @forum, @topic),
                success: subscription_state_text(true)
  else
    redirect_to course_forum_topic_path(current_course, @forum, @topic),
                danger: subscription_state_text(false)
  end
end