Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
0359d41b
Commit
0359d41b
authored
May 11, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement gfm_reference directly in Mentionable
Except for Note, which still overrides it.
parent
38fb6279
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
19 deletions
+8
-19
app/models/commit.rb
app/models/commit.rb
+0
-5
app/models/concerns/mentionable.rb
app/models/concerns/mentionable.rb
+8
-3
app/models/issue.rb
app/models/issue.rb
+0
-6
app/models/merge_request.rb
app/models/merge_request.rb
+0
-5
No files found.
app/models/commit.rb
View file @
0359d41b
...
...
@@ -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
...
...
app/models/concerns/mentionable.rb
View file @
0359d41b
...
...
@@ -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.
...
...
app/models/issue.rb
View file @
0359d41b
...
...
@@ -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:
...
...
app/models/merge_request.rb
View file @
0359d41b
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment