Welcome to mirror list, hosted at ThFree Co, Russian Federation.

toggle_subscription_action.rb « concerns « controllers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e613bfaeef23f15f6e6ba7f6ab1d69b0b51c7063 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

module ToggleSubscriptionAction
  extend ActiveSupport::Concern

  def toggle_subscription
    return unless current_user

    subscribable_resource.toggle_subscription(current_user, subscribable_project)

    head :ok
  end

  private

  def subscribable_project
    @project ||= raise(NotImplementedError)
  end

  def subscribable_resource
    raise NotImplementedError
  end
end