debian-mirror-gitlab/lib/gitlab/slash_commands/presenters/issue_close.rb

34 lines
787 B
Ruby
Raw Normal View History

2019-12-04 20:38:33 +05:30
# frozen_string_literal: true
module Gitlab
module SlashCommands
module Presenters
class IssueClose < Presenters::Base
include Presenters::IssueBase
def present
2020-01-01 13:55:28 +05:30
if resource.confidential?
ephemeral_response(response_message)
2019-12-04 20:38:33 +05:30
else
2020-01-01 13:55:28 +05:30
in_channel_response(response_message)
2019-12-04 20:38:33 +05:30
end
end
def already_closed
2020-01-01 13:55:28 +05:30
ephemeral_response(text: "Issue #{resource.to_reference} is already closed.")
2019-12-04 20:38:33 +05:30
end
private
2020-01-01 13:55:28 +05:30
def fallback_message
"Closed issue #{issue.to_reference}: #{issue.title}"
2019-12-04 20:38:33 +05:30
end
def pretext
2020-01-01 13:55:28 +05:30
"I closed an issue on #{author_profile_link}'s behalf: *#{issue.to_reference}* in #{project_link}"
2019-12-04 20:38:33 +05:30
end
end
end
end
end