2019-08-29 16:27:38 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module SlashCommands
|
|
|
|
module Presenters
|
|
|
|
class IssueClose < Presenters::Base
|
|
|
|
include Presenters::IssueBase
|
|
|
|
|
|
|
|
def present
|
2019-11-29 10:06:43 -05:00
|
|
|
if resource.confidential?
|
|
|
|
ephemeral_response(response_message)
|
2019-08-29 16:27:38 -04:00
|
|
|
else
|
2019-11-29 10:06:43 -05:00
|
|
|
in_channel_response(response_message)
|
2019-08-29 16:27:38 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def already_closed
|
2019-11-29 10:06:43 -05:00
|
|
|
ephemeral_response(text: "Issue #{resource.to_reference} is already closed.")
|
2019-08-29 16:27:38 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2019-11-29 10:06:43 -05:00
|
|
|
def fallback_message
|
|
|
|
"Closed issue #{issue.to_reference}: #{issue.title}"
|
2019-08-29 16:27:38 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def pretext
|
2019-11-29 10:06:43 -05:00
|
|
|
"I closed an issue on #{author_profile_link}'s behalf: *#{issue.to_reference}* in #{project_link}"
|
2019-08-29 16:27:38 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|