mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-01-19 13:26:04 +01:00
e07d069c73
Also removed the unused `Ajax::QuestionController#preview` method and route
19 lines
636 B
Ruby
19 lines
636 B
Ruby
class Ajax::SubscriptionController < AjaxController
|
|
before_action :authenticate_user!
|
|
|
|
def subscribe
|
|
params.require :answer
|
|
@response[:status] = 418
|
|
@response[:message] = I18n.t('messages.subscription.torpedo')
|
|
state = Subscription.subscribe(current_user, Answer.find(params[:answer])).nil?
|
|
@response[:success] = state == false
|
|
end
|
|
|
|
def unsubscribe
|
|
params.require :answer
|
|
@response[:status] = 418
|
|
@response[:message] = I18n.t('messages.subscription.torpedo')
|
|
state = Subscription.unsubscribe(current_user, Answer.find(params[:answer])).nil?
|
|
@response[:success] = state == false
|
|
end
|
|
end
|