Commit 6d67a860 authored by Stan Hu's avatar Stan Hu

Merge branch '329759-remove-service-instance-variable-from-integrations-contollers' into 'master'

Remove `service` instance variable from integrations contollers

See merge request gitlab-org/gitlab!62551
parents 3235388c 0cbf5abc
......@@ -51,7 +51,6 @@ module IntegrationsActions
# rubocop:disable Gitlab/ModuleWithInstanceVariables
def integration
@integration ||= find_or_initialize_non_project_specific_integration(params[:id])
@service ||= @integration # TODO: remove references to @service https://gitlab.com/gitlab-org/gitlab/-/issues/329759
end
# rubocop:enable Gitlab/ModuleWithInstanceVariables
......
......@@ -85,14 +85,13 @@ class Projects::ServicesController < Projects::ApplicationController
def integration
@integration ||= @project.find_or_initialize_service(params[:id])
@service ||= @integration # TODO: remove references to @service https://gitlab.com/gitlab-org/gitlab/-/issues/329759
end
alias_method :service, :integration
def web_hook_logs
return unless @service.service_hook.present?
return unless integration.service_hook.present?
@web_hook_logs ||= @service.service_hook.web_hook_logs.recent.page(params[:page])
@web_hook_logs ||= integration.service_hook.web_hook_logs.recent.page(params[:page])
end
def ensure_service_enabled
......@@ -101,8 +100,8 @@ class Projects::ServicesController < Projects::ApplicationController
def serialize_as_json
integration
.as_json(only: @service.json_fields)
.merge(errors: @service.errors.as_json)
.as_json(only: integration.json_fields)
.merge(errors: integration.errors.as_json)
end
def redirect_deprecated_prometheus_service
......
......@@ -9,7 +9,7 @@ module Projects
feature_category :integrations
def show
@services = @project.find_or_initialize_services
@integrations = @project.find_or_initialize_services
end
end
end
......
......@@ -6,4 +6,4 @@
- integrations_link_start = '<a href="%{url}">'.html_safe % { url: help_page_url('user/project/integrations/overview') }
- webhooks_link_start = '<a href="%{url}">'.html_safe % { url: project_hooks_path(@project) }
%p= _("%{integrations_link_start}Integrations%{link_end} enable you to make third-party applications part of your GitLab workflow. If the available integrations don't meet your needs, consider using a %{webhooks_link_start}webhook%{link_end}.").html_safe % { integrations_link_start: integrations_link_start, webhooks_link_start: webhooks_link_start, link_end: '</a>'.html_safe }
= render 'shared/integrations/index', integrations: @services
= render 'shared/integrations/index', integrations: @integrations
......@@ -28,7 +28,7 @@ RSpec.describe Projects::Settings::IntegrationsController do
end
context 'sets correct services list' do
let(:active_services) { assigns(:services).map(&:type) }
let(:active_services) { assigns(:integrations).map(&:type) }
let(:disabled_services) { %w[GithubService] }
it 'enables SlackSlashCommandsService and disables GitlabSlackApplication' do
......
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