2016-03-15 12:24:55 -04:00
|
|
|
module ToggleSubscriptionAction
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
def toggle_subscription
|
|
|
|
return unless current_user
|
|
|
|
|
2016-10-31 15:21:13 -04:00
|
|
|
subscribable_resource.toggle_subscription(current_user, subscribable_project)
|
2016-03-15 12:24:55 -04:00
|
|
|
|
2016-03-15 21:16:25 -04:00
|
|
|
head :ok
|
2016-03-15 12:24:55 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2016-10-31 15:21:13 -04:00
|
|
|
def subscribable_project
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
2016-03-15 12:24:55 -04:00
|
|
|
def subscribable_resource
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
end
|