diff options
Diffstat (limited to 'app/controllers/projects/settings/integrations_controller.rb')
-rw-r--r-- | app/controllers/projects/settings/integrations_controller.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/app/controllers/projects/settings/integrations_controller.rb b/app/controllers/projects/settings/integrations_controller.rb index 03ef434456f..2bbcd9fe20c 100644 --- a/app/controllers/projects/settings/integrations_controller.rb +++ b/app/controllers/projects/settings/integrations_controller.rb @@ -11,7 +11,7 @@ module Projects before_action :integration, only: [:edit, :update, :test] before_action :default_integration, only: [:edit, :update] before_action :web_hook_logs, only: [:edit, :update] - before_action -> { check_rate_limit!(:project_testing_integration, scope: [@project, current_user]) }, only: :test + before_action -> { check_test_rate_limit! }, only: :test respond_to :html @@ -124,7 +124,7 @@ module Projects def web_hook_logs return unless integration.try(:service_hook).present? - @web_hook_logs ||= integration.service_hook.web_hook_logs.recent.page(params[:page]) + @web_hook_logs ||= integration.service_hook.web_hook_logs.recent.page(params[:page]).without_count end def ensure_integration_enabled @@ -140,6 +140,15 @@ module Projects def use_inherited_settings?(attributes) default_integration && attributes[:inherit_from_id] == default_integration.id.to_s end + + def check_test_rate_limit! + check_rate_limit!(:project_testing_integration, scope: [@project, current_user]) do + render json: { + error: true, + message: _('This endpoint has been requested too many times. Try again later.') + }, status: :ok + end + end end end end |