2019-02-15 15:39:39 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
module Gitlab
|
2017-09-10 17:25:29 +05:30
|
|
|
module SlashCommands
|
2017-08-17 22:00:37 +05:30
|
|
|
module Presenters
|
|
|
|
class IssueShow < Presenters::Base
|
|
|
|
include Presenters::IssueBase
|
|
|
|
|
|
|
|
def present
|
2020-01-01 13:55:28 +05:30
|
|
|
if resource.confidential?
|
|
|
|
ephemeral_response(response_message)
|
2017-08-17 22:00:37 +05:30
|
|
|
else
|
2020-01-01 13:55:28 +05:30
|
|
|
in_channel_response(response_message)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2020-01-01 13:55:28 +05:30
|
|
|
def fallback_message
|
|
|
|
"Issue #{resource.to_reference}: #{resource.title}"
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def text
|
2020-01-01 13:55:28 +05:30
|
|
|
message = ["**#{status_text(resource)}**"]
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
if resource.upvotes == 0 && resource.downvotes == 0 && resource.user_notes_count == 0
|
2019-02-15 15:39:39 +05:30
|
|
|
return message.join
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
message << " · "
|
2020-10-24 23:57:45 +05:30
|
|
|
message << ":+1: #{resource.upvotes} " unless resource.upvotes == 0
|
|
|
|
message << ":-1: #{resource.downvotes} " unless resource.downvotes == 0
|
|
|
|
message << ":speech_balloon: #{resource.user_notes_count}" unless resource.user_notes_count == 0
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
message.join
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def pretext
|
2020-01-01 13:55:28 +05:30
|
|
|
"Issue *#{resource.to_reference}* from #{project.full_name}"
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|