[refs #579] small refactoring
This commit is contained in:
parent
ea1ec80d29
commit
54f462f408
|
@ -17,9 +17,9 @@ module CommentsHelper
|
|||
end
|
||||
|
||||
def project_commentable_comments_path(project, commentable)
|
||||
if commentable.class == Issue
|
||||
if commentable.is_a? Issue
|
||||
project_issue_comments_path(@project, @commentable)
|
||||
elsif commentable.class == Grit::Commit
|
||||
elsif commentable.is_a? Grit::Commit
|
||||
project_commit_comments_path(@project, @commentable)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -258,9 +258,9 @@ module DiffHelper
|
|||
|
||||
def new_comment_path
|
||||
hash = {:path => @filepath, :line => @num_line}
|
||||
if @commentable.class == Issue
|
||||
if @commentable.is_a? Issue
|
||||
project_new_line_pull_comment_path(@project, @commentable, hash.merge({:in_reply => @add_reply_id}))
|
||||
elsif @commentable.class == Grit::Commit
|
||||
elsif @commentable.is_a? Grit::Commit
|
||||
new_line_commit_comment_path(@project, @commentable, hash)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -84,7 +84,7 @@ class Comment < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def pull_comment?
|
||||
return true if commentable.class == Issue && commentable.pull_request.present?
|
||||
return true if commentable.is_a?(Issue) && commentable.pull_request.present?
|
||||
end
|
||||
|
||||
def set_additional_data params
|
||||
|
@ -94,7 +94,7 @@ class Comment < ActiveRecord::Base
|
|||
return true
|
||||
end
|
||||
self.data = {:path => params[:path], :line => params[:line]}
|
||||
if commentable.class == Issue && pull = commentable.pull_request
|
||||
if commentable.is_a?(Issue) && pull = commentable.pull_request
|
||||
diff_path = pull.diff.select {|d| d.a_path == params[:path]}
|
||||
return false unless actual_inline_comment?(pull.diff, true)
|
||||
|
||||
|
|
Loading…
Reference in New Issue