Module: Mutations::ResolvesSubscription

Extended by:
ActiveSupport::Concern
Included in:
Issues::SetSubscription, MergeRequests::SetSubscription
Defined in:
app/graphql/mutations/concerns/mutations/resolves_subscription.rb

Instance Method Summary collapse

Instance Method Details

#resolve(project_path:, iid:, subscribed_state:) ⇒ Object


13
14
15
16
17
18
19
20
21
22
23
# File 'app/graphql/mutations/concerns/mutations/resolves_subscription.rb', line 13

def resolve(project_path:, iid:, subscribed_state:)
  resource = authorized_find!(project_path: project_path, iid: iid)
  project = resource.project

  resource.set_subscription(current_user, subscribed_state, project)

  {
    resource.class.name.underscore.to_sym => resource,
    errors: errors_on_object(resource)
  }
end