Extract logic from NotifyService into own services

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

  • Close this issue

The following discussion from !9768 (merged) should be addressed:

  • @ashmckenzie started a discussion: (+2 comments)

    Looking at the original naming of this class, I feel it's not longer an accurate name for what it's now going to be responsible for.

    WDYT about splitting up the sending email logic and the creating issues logic into two separate classes? e.g.

    class NotifyService < BaseService
      def execute(token)
        return false unless valid_version?
        return false unless valid_alert_manager_token?(token)
    
        SendEmailsFromAlerts.new(project, firings).execute if send_email?
        CreateIssuesFromAlerts.new(project, firings).execute if create_issue?
        persist_events
    
        true
      end
    end

    Also, WDYT about encapsulating the logic around determining incident_management_setting into a separate class too?

    This should assist with:

    _GitLab_Enterprise_Edition___GitLab_2019-03-15_19-19-52

Edited Sep 26, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading