Commit 43aca15e authored by Anton Smith's avatar Anton Smith Committed by Luke Duncalfe

Remove Slack attachment in new issue presenter

https://gitlab.com/gitlab-org/gitlab/-/issues/324600
parent e3df0b6e
---
title: Remove Slack attachment from new issues created via Slash commands
merge_request: 57431
author:
type: changed
......@@ -12,16 +12,18 @@ module Gitlab
private
def fallback_message
"New issue #{issue.to_reference}: #{issue.title}"
def pretext
"I created an issue on #{author_profile_link}'s behalf: *#{issue_link}* in #{project_link}"
end
def fields_with_markdown
%i(title pretext text fields)
def issue_link
"[#{issue.to_reference}](#{project_issue_url(issue.project, issue)})"
end
def pretext
"I created an issue on #{author_profile_link}'s behalf: *#{issue.to_reference}* in #{project_link}"
def response_message(custom_pretext: pretext)
{
text: pretext
}
end
end
end
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::SlashCommands::Presenters::IssueNew do
include Gitlab::Routing
let(:project) { create(:project) }
let(:issue) { create(:issue, project: project) }
let(:attachment) { subject[:attachments].first }
subject { described_class.new(issue).present }
it { is_expected.to be_a(Hash) }
it 'shows the issue' do
expect(subject[:response_type]).to be(:in_channel)
expect(subject).to have_key(:attachments)
expect(attachment[:title]).to start_with(issue.title)
expected_text = "I created an issue on <#{url_for(issue.author)}|#{issue.author.to_reference}>'s behalf: *<#{project_issue_url(issue.project, issue)}|#{issue.to_reference}>* in <#{project.web_url}|#{project.full_name}>"
expect(subject).to eq(
response_type: :in_channel,
status: 200,
text: expected_text
)
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