Commit 1b8869ef authored by Vitali Tatarintev's avatar Vitali Tatarintev

Replace @resource with resource

Replace @resource with resource in SlashCommands modules
for consistency reasons
parent 592f26c6
......@@ -34,8 +34,8 @@ module Gitlab
def authorize
message =
if @resource
":wave: Hi there! Before I do anything for you, please [connect your GitLab account](#{@resource})."
if resource
":wave: Hi there! Before I do anything for you, please [connect your GitLab account](#{resource})."
else
":sweat_smile: Couldn't identify you, nor can I authorize you!"
end
......
......@@ -7,7 +7,7 @@ module Gitlab
include Presenters::IssueBase
def present
if @resource.confidential?
if resource.confidential?
ephemeral_response(response_message)
else
in_channel_response(response_message)
......@@ -15,7 +15,7 @@ module Gitlab
end
def already_closed
ephemeral_response(text: "Issue #{@resource.to_reference} is already closed.")
ephemeral_response(text: "Issue #{resource.to_reference} is already closed.")
end
private
......
......@@ -7,12 +7,12 @@ module Gitlab
include Presenters::IssueBase
def present
text = if @resource.count >= 5
text = if resource.count >= 5
"Here are the first 5 issues I found:"
elsif @resource.one?
elsif resource.one?
"Here is the only issue I found:"
else
"Here are the #{@resource.count} issues I found:"
"Here are the #{resource.count} issues I found:"
end
ephemeral_response(text: text, attachments: attachments)
......@@ -21,7 +21,7 @@ module Gitlab
private
def attachments
@resource.map do |issue|
resource.map do |issue|
url = "[#{issue.to_reference}](#{url_for([namespace, project, issue])})"
{
......@@ -37,7 +37,7 @@ module Gitlab
end
def project
@project ||= @resource.first.project
@project ||= resource.first.project
end
def namespace
......
......@@ -7,7 +7,7 @@ module Gitlab
include Presenters::IssueBase
def present
if @resource.confidential?
if resource.confidential?
ephemeral_response(response_message)
else
in_channel_response(response_message)
......@@ -17,26 +17,26 @@ module Gitlab
private
def fallback
"Issue #{@resource.to_reference}: #{@resource.title}"
"Issue #{resource.to_reference}: #{resource.title}"
end
def text
message = ["**#{status_text(@resource)}**"]
message = ["**#{status_text(resource)}**"]
if @resource.upvotes.zero? && @resource.downvotes.zero? && @resource.user_notes_count.zero?
if resource.upvotes.zero? && resource.downvotes.zero? && resource.user_notes_count.zero?
return message.join
end
message << " · "
message << ":+1: #{@resource.upvotes} " unless @resource.upvotes.zero?
message << ":-1: #{@resource.downvotes} " unless @resource.downvotes.zero?
message << ":speech_balloon: #{@resource.user_notes_count}" unless @resource.user_notes_count.zero?
message << ":+1: #{resource.upvotes} " unless resource.upvotes.zero?
message << ":-1: #{resource.downvotes} " unless resource.downvotes.zero?
message << ":speech_balloon: #{resource.user_notes_count}" unless resource.user_notes_count.zero?
message.join
end
def pretext
"Issue *#{@resource.to_reference}* from #{project.full_name}"
"Issue *#{resource.to_reference}* from #{project.full_name}"
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment