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
Kazuhiko Shiozaki
gitlab-ce
Commits
d9698628
Commit
d9698628
authored
Mar 27, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Commit#author and #committer.
parent
403b7271
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
4 deletions
+13
-4
app/helpers/commits_helper.rb
app/helpers/commits_helper.rb
+4
-3
app/models/commit.rb
app/models/commit.rb
+8
-0
app/services/git_push_service.rb
app/services/git_push_service.rb
+1
-1
No files found.
app/helpers/commits_helper.rb
View file @
d9698628
...
...
@@ -134,12 +134,13 @@ module CommitsHelper
# avatar: true will prepend the avatar image
# size: size of the avatar image in px
def
commit_person_link
(
commit
,
options
=
{})
user
=
commit
.
send
(
options
[
:source
])
source_name
=
clean
(
commit
.
send
"
#{
options
[
:source
]
}
_name"
.
to_sym
)
source_email
=
clean
(
commit
.
send
"
#{
options
[
:source
]
}
_email"
.
to_sym
)
user
=
User
.
find_for_commit
(
source_email
,
source_name
)
person_name
=
user
.
nil?
?
source_name
:
user
.
name
person_email
=
user
.
nil?
?
source_email
:
user
.
email
person_name
=
user
.
try
(
:name
)
||
source_name
person_email
=
user
.
try
(
:email
)
||
source_email
text
=
if
options
[
:avatar
]
...
...
app/models/commit.rb
View file @
d9698628
...
...
@@ -126,6 +126,14 @@ class Commit
"commit
#{
id
}
"
end
def
author
User
.
find_for_commit
(
author_email
,
author_name
)
end
def
committer
User
.
find_for_commit
(
committer_email
,
committer_name
)
end
def
method_missing
(
m
,
*
args
,
&
block
)
@raw
.
send
(
m
,
*
args
,
&
block
)
end
...
...
app/services/git_push_service.rb
View file @
d9698628
...
...
@@ -127,6 +127,6 @@ class GitPushService
end
def
commit_user
(
commit
)
User
.
find_for_commit
(
commit
.
author_email
,
commit
.
author_name
)
||
user
commit
.
author
||
user
end
end
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