Read about our upcoming Code of Conduct on this issue

This instance will be upgraded to Heptapod 0.28.0 on 2022-01-18 at 14:00 UTC+1 (a few minutes of down time)

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

Implement gfm_reference directly in Mentionable

Except for Note, which still overrides it.
parent c10c91d7cc9f
......@@ -140,11 +140,6 @@ def closes_issues(current_user = self.committer)
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 @@ def mentionable_attrs
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 @@ def to_reference(from_project = nil)
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 @@ def closes_issues(current_user = self.author)
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