Commit 63b7d8f3 authored by Yorick Peterse's avatar Yorick Peterse

Don't send schedule confirmations for chat jobs

Previously whenever you'd schedule a chatops command we'd respond with
the message "The command has been scheduled!" which was a link to the
new build. Such messages can get annoying very quickly.

Fortunately there's a trick we can use: when you send back an empty
message Slack won't show said message, but it _will_ show the input
command.
parent a5c567d2
---
title: Don't send schedule confirmations for chat jobs
merge_request:
author:
type: changed
......@@ -47,9 +47,10 @@ module Gitlab
# Returns the output to send back after a command has been scheduled.
def scheduled_output
{
text: message_text("<#{build_url}|The command has been scheduled!>")
}
# We return an empty message so that Slack still shows the input
# command, without polluting the channel with standard "The job has
# been scheduled" (or similar) responses.
{ text: '' }
end
private
......
......@@ -69,7 +69,7 @@ describe Gitlab::Chat::Responder::Slack do
it 'returns the output for a scheduled build' do
output = responder.scheduled_output
expect(output[:text]).to match(/<@U123>:.+The command has been scheduled!/)
expect(output).to eq({ text: '' })
end
end
end
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