Commit 4eac6bc2 authored by Alex Kalderimis's avatar Alex Kalderimis

Remove duplicate method

parent a3023011
......@@ -146,7 +146,7 @@ class Project < ApplicationRecord
has_one :last_event, -> {order 'events.created_at DESC'}, class_name: 'Event'
has_many :boards
def self.integration_association(name)
def self.integration_association_name(name)
if ::Integration.renamed?(name)
"#{name}_integration"
else
......
......@@ -160,7 +160,8 @@ module Gitlab
# We treat underscored_service as a trusted input because it is included
# in the Integration.available_services_names allowlist.
service = project.public_send(Project.integration_association(underscored_service)) # rubocop:disable GitlabSecurity/PublicSend
accessor = Project.integration_association_name(underscored_service)
service = project.public_send(accessor) # rubocop:disable GitlabSecurity/PublicSend
return unless service && service.activated? && service.valid_token?(password)
......
......@@ -5,7 +5,7 @@ Integration.available_services_names.each do |service|
include JiraServiceHelper if service == 'jira'
let(:dashed_service) { service.dasherize }
let(:service_method) { integration_association(service) }
let(:service_method) { Project.integration_association_name(service) }
let(:service_klass) { Integration.integration_name_to_model(service) }
let(:service_instance) { service_klass.new }
let(:service_fields) { service_instance.fields }
......@@ -57,16 +57,6 @@ Integration.available_services_names.each do |service|
service_item
end
# Returns the association name for the given integration.
# Example: 'asana' => 'asana_integration'
def integration_association(name)
if Integration::RENAMED_TO_INTEGRATION.include?(name)
"#{name}_integration".to_sym
else
"#{name}_service".to_sym
end
end
private
def enable_license_for_service(service)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment