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 ...@@ -34,8 +34,8 @@ module Gitlab
def authorize def authorize
message = message =
if @resource if resource
":wave: Hi there! Before I do anything for you, please [connect your GitLab account](#{@resource})." ":wave: Hi there! Before I do anything for you, please [connect your GitLab account](#{resource})."
else else
":sweat_smile: Couldn't identify you, nor can I authorize you!" ":sweat_smile: Couldn't identify you, nor can I authorize you!"
end end
......
...@@ -7,7 +7,7 @@ module Gitlab ...@@ -7,7 +7,7 @@ module Gitlab
include Presenters::IssueBase include Presenters::IssueBase
def present def present
if @resource.confidential? if resource.confidential?
ephemeral_response(response_message) ephemeral_response(response_message)
else else
in_channel_response(response_message) in_channel_response(response_message)
...@@ -15,7 +15,7 @@ module Gitlab ...@@ -15,7 +15,7 @@ module Gitlab
end end
def already_closed def already_closed
ephemeral_response(text: "Issue #{@resource.to_reference} is already closed.") ephemeral_response(text: "Issue #{resource.to_reference} is already closed.")
end end
private private
......
...@@ -7,12 +7,12 @@ module Gitlab ...@@ -7,12 +7,12 @@ module Gitlab
include Presenters::IssueBase include Presenters::IssueBase
def present def present
text = if @resource.count >= 5 text = if resource.count >= 5
"Here are the first 5 issues I found:" "Here are the first 5 issues I found:"
elsif @resource.one? elsif resource.one?
"Here is the only issue I found:" "Here is the only issue I found:"
else else
"Here are the #{@resource.count} issues I found:" "Here are the #{resource.count} issues I found:"
end end
ephemeral_response(text: text, attachments: attachments) ephemeral_response(text: text, attachments: attachments)
...@@ -21,7 +21,7 @@ module Gitlab ...@@ -21,7 +21,7 @@ module Gitlab
private private
def attachments def attachments
@resource.map do |issue| resource.map do |issue|
url = "[#{issue.to_reference}](#{url_for([namespace, project, issue])})" url = "[#{issue.to_reference}](#{url_for([namespace, project, issue])})"
{ {
...@@ -37,7 +37,7 @@ module Gitlab ...@@ -37,7 +37,7 @@ module Gitlab
end end
def project def project
@project ||= @resource.first.project @project ||= resource.first.project
end end
def namespace def namespace
......
...@@ -7,7 +7,7 @@ module Gitlab ...@@ -7,7 +7,7 @@ module Gitlab
include Presenters::IssueBase include Presenters::IssueBase
def present def present
if @resource.confidential? if resource.confidential?
ephemeral_response(response_message) ephemeral_response(response_message)
else else
in_channel_response(response_message) in_channel_response(response_message)
...@@ -17,26 +17,26 @@ module Gitlab ...@@ -17,26 +17,26 @@ module Gitlab
private private
def fallback def fallback
"Issue #{@resource.to_reference}: #{@resource.title}" "Issue #{resource.to_reference}: #{resource.title}"
end end
def text 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 return message.join
end end
message << " · " message << " · "
message << ":+1: #{@resource.upvotes} " unless @resource.upvotes.zero? message << ":+1: #{resource.upvotes} " unless resource.upvotes.zero?
message << ":-1: #{@resource.downvotes} " unless @resource.downvotes.zero? message << ":-1: #{resource.downvotes} " unless resource.downvotes.zero?
message << ":speech_balloon: #{@resource.user_notes_count}" unless @resource.user_notes_count.zero? message << ":speech_balloon: #{resource.user_notes_count}" unless resource.user_notes_count.zero?
message.join message.join
end end
def pretext def pretext
"Issue *#{@resource.to_reference}* from #{project.full_name}" "Issue *#{resource.to_reference}* from #{project.full_name}"
end end
end 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