2016-03-15 16:24:55 +00:00
|
|
|
module ToggleSubscriptionAction
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
def toggle_subscription
|
|
|
|
return unless current_user
|
|
|
|
|
2016-10-31 19:21:13 +00:00
|
|
|
subscribable_resource.toggle_subscription(current_user, subscribable_project)
|
2016-03-15 16:24:55 +00:00
|
|
|
|
2016-03-16 01:16:25 +00:00
|
|
|
head :ok
|
2016-03-15 16:24:55 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2016-10-31 19:21:13 +00:00
|
|
|
def subscribable_project
|
2017-11-17 12:27:16 +00:00
|
|
|
@project ||= raise(NotImplementedError)
|
2016-10-31 19:21:13 +00:00
|
|
|
end
|
|
|
|
|
2016-03-15 16:24:55 +00:00
|
|
|
def subscribable_resource
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
end
|