Commit 4f1a31ed authored by Vitali Tatarintev's avatar Vitali Tatarintev

Rename generic alert notifications controller

Rename the controller to `Projects::Alerting::NotificationsController`
Change route to `alerts/notify`
parent 4ff721cc
# frozen_string_literal: true
module Projects
class AlertNotificationsController < Projects::ApplicationController
respond_to :json
skip_before_action :project
prepend_before_action :repository, :project_without_auth
before_action :check_generic_alert_endpoint_feature_flag!
def create
head :ok
end
private
def project_without_auth
return @project if @project
namespace = params[:namespace_id]
id = params[:project_id]
@project = Project.find_by_full_path("#{namespace}/#{id}")
end
def check_generic_alert_endpoint_feature_flag!
render_404 unless Feature.enabled?(:generic_alert_endpoint, @project)
end
end
end
# frozen_string_literal: true
module Projects
module Alerting
class NotificationsController < Projects::ApplicationController
respond_to :json
skip_before_action :project
prepend_before_action :repository, :project_without_auth
before_action :check_generic_alert_endpoint_feature_flag!
def create
head :ok
end
private
def project_without_auth
return @project if @project
namespace = params[:namespace_id]
id = params[:project_id]
@project = Project.find_by_full_path("#{namespace}/#{id}")
end
def check_generic_alert_endpoint_feature_flag!
render_404 unless Feature.enabled?(:generic_alert_endpoint, @project)
end
end
end
end
......@@ -52,7 +52,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
# End of the /-/ scope.
resource :alert_notification, only: :create
post 'alerts/notify', to: 'alerting/notifications#create'
resource :tracing, only: [:show]
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
describe Projects::AlertNotificationsController do
describe Projects::Alerting::NotificationsController do
set(:project) { create(:project) }
set(:environment) { create(:environment, project: project) }
......
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