Commit 0359d41b authored by Robert Speicher's avatar Robert Speicher

Implement gfm_reference directly in Mentionable

Except for Note, which still overrides it.
parent 38fb6279
......@@ -140,11 +140,6 @@ class Commit
Gitlab::ClosingIssueExtractor.new(project, current_user).closed_by_message(safe_message)
end
# Mentionable override.
def gfm_reference
"commit #{to_reference}"
end
def author
User.find_for_commit(author_email, author_name)
end
......
......@@ -20,10 +20,15 @@ module Mentionable
end
end
# Generate a GFM back-reference that will construct a link back to this Mentionable when rendered. Must
# be overridden if this model object can be referenced directly by GFM notation.
# Returns the text used as the body of a Note when this object is referenced
#
# By default this will be the class name and the result of calling
# `to_reference` on the object.
def gfm_reference
raise NotImplementedError.new("#{self.class} does not implement #gfm_reference")
# Convert "MergeRequest" to "merge request"
friendly_name = self.class.to_s.underscore.humanize.downcase
"#{friendly_name} #{to_reference}"
end
# Construct a String that contains possible GFM references.
......
......@@ -68,12 +68,6 @@ class Issue < ActiveRecord::Base
reference
end
# Mentionable overrides.
def gfm_reference
"issue #{to_reference}"
end
# Reset issue events cache
#
# Since we do cache @event we need to reset cache in special cases:
......
......@@ -304,11 +304,6 @@ class MergeRequest < ActiveRecord::Base
end
end
# Mentionable override.
def gfm_reference
"merge request #{to_reference}"
end
def target_project_path
if target_project
target_project.path_with_namespace
......
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