Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
43aca15e
Commit
43aca15e
authored
Mar 31, 2021
by
Anton Smith
Committed by
Luke Duncalfe
Mar 31, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove Slack attachment in new issue presenter
https://gitlab.com/gitlab-org/gitlab/-/issues/324600
parent
e3df0b6e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
11 deletions
+21
-11
changelogs/unreleased/324600-new-issue-remove-attachment.yml
changelogs/unreleased/324600-new-issue-remove-attachment.yml
+5
-0
lib/gitlab/slash_commands/presenters/issue_new.rb
lib/gitlab/slash_commands/presenters/issue_new.rb
+8
-6
spec/lib/gitlab/slash_commands/presenters/issue_new_spec.rb
spec/lib/gitlab/slash_commands/presenters/issue_new_spec.rb
+8
-5
No files found.
changelogs/unreleased/324600-new-issue-remove-attachment.yml
0 → 100644
View file @
43aca15e
---
title
:
Remove Slack attachment from new issues created via Slash commands
merge_request
:
57431
author
:
type
:
changed
lib/gitlab/slash_commands/presenters/issue_new.rb
View file @
43aca15e
...
...
@@ -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
...
...
spec/lib/gitlab/slash_commands/presenters/issue_new_spec.rb
View file @
43aca15e
# 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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment