Sha256: c6e7377a08061d838dcfb3263ca66d8f772589b638f5ef797681e7f12e732fae

Contents?: true

Size: 975 Bytes

Versions: 13

Compression:

Stored size: 975 Bytes

Contents

class Commontator::SubscriptionsController < Commontator::ApplicationController
  before_action :set_thread

  # PUT /threads/1/subscribe
  def subscribe
    security_transgression_unless @commontator_thread.can_subscribe?(@commontator_user)

    @commontator_thread.errors.add(:base, t('commontator.subscription.errors.already_subscribed')) \
      unless @commontator_thread.subscribe(@commontator_user)

    respond_to do |format|
      format.html { redirect_to commontable_url }
      format.js   { render :subscribe }
    end

  end

  # PUT /threads/1/unsubscribe
  def unsubscribe
    security_transgression_unless @commontator_thread.can_subscribe?(@commontator_user)

    @commontator_thread.errors.add(:base, t('commontator.subscription.errors.not_subscribed')) \
      unless @commontator_thread.unsubscribe(@commontator_user)

    respond_to do |format|
      format.html { redirect_to commontable_url }
      format.js   { render :subscribe }
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
commontator-7.0.1 app/controllers/commontator/subscriptions_controller.rb
commontator-7.0.0 app/controllers/commontator/subscriptions_controller.rb
commontator-6.3.2 app/controllers/commontator/subscriptions_controller.rb
commontator-6.3.1 app/controllers/commontator/subscriptions_controller.rb
commontator-6.3.0 app/controllers/commontator/subscriptions_controller.rb
commontator-6.2.1 app/controllers/commontator/subscriptions_controller.rb
commontator-6.2.0 app/controllers/commontator/subscriptions_controller.rb
commontator-6.1.1 app/controllers/commontator/subscriptions_controller.rb
commontator-6.1.0 app/controllers/commontator/subscriptions_controller.rb
commontator-6.0.1 app/controllers/commontator/subscriptions_controller.rb
commontator-6.0.0 app/controllers/commontator/subscriptions_controller.rb
commontator-6.0.0.pre.2 app/controllers/commontator/subscriptions_controller.rb
commontator-6.0.0.pre.1 app/controllers/commontator/subscriptions_controller.rb