blob: b3f24f4296ae8ab298e09d90b26504ea9f2e7697 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# frozen_string_literal: true
module Gitlab
module SlashCommands
module Presenters
class IssueClose < Presenters::Base
include Presenters::IssueBase
def present
if @resource.confidential?
ephemeral_response(close_issue)
else
in_channel_response(close_issue)
end
end
def already_closed
ephemeral_response(text: "Issue #{@resource.to_reference} is already closed.")
end
private
def close_issue
{
attachments: [
{
title: "#{@resource.title} · #{@resource.to_reference}",
title_link: resource_url,
author_name: author.name,
author_icon: author.avatar_url,
fallback: "Closed issue #{@resource.to_reference}: #{@resource.title}",
pretext: pretext,
color: color(@resource),
fields: fields,
mrkdwn_in: [
:title,
:pretext,
:fields
]
}
]
}
end
def pretext
"I closed an issue on #{author_profile_link}'s behalf: *#{@resource.to_reference}* in #{project_link}"
end
end
end
end
end
|