diff options
author | James Fargher <proglottis@gmail.com> | 2019-01-30 11:10:04 +1300 |
---|---|---|
committer | James Fargher <proglottis@gmail.com> | 2019-02-07 10:55:30 +1300 |
commit | bdd1bac2f0ca6760376ae422c68ba9c787c199c3 (patch) | |
tree | 2b90be8ecb8f93c75ccd5247c6d47e330d70b7e1 /lib/gitlab/chat/responder.rb | |
parent | f67690057b4711654f71565999040c1819aa0323 (diff) | |
download | gitlab-ce-bdd1bac2f0ca6760376ae422c68ba9c787c199c3.tar.gz |
Move ChatOps to Coremove_chatops_to_core
ChatOps used to be in the Ultimate tier.
Diffstat (limited to 'lib/gitlab/chat/responder.rb')
-rw-r--r-- | lib/gitlab/chat/responder.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/gitlab/chat/responder.rb b/lib/gitlab/chat/responder.rb new file mode 100644 index 00000000000..6267fbc20e2 --- /dev/null +++ b/lib/gitlab/chat/responder.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module Gitlab + module Chat + module Responder + # Returns an instance of the responder to use for generating chat + # responses. + # + # This method will return `nil` if no formatter is available for the given + # build. + # + # build - A `Ci::Build` that executed a chat command. + def self.responder_for(build) + service = build.pipeline.chat_data&.chat_name&.service + + if (responder = service.try(:chat_responder)) + responder.new(build) + end + end + end + end +end |