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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
ca9cedea
Commit
ca9cedea
authored
Feb 20, 2020
by
Robert May
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Filter commits by author in controller
Adds ability to filter commits by the author name in the controller.
parent
9e9a2cc9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
app/controllers/projects/commits_controller.rb
app/controllers/projects/commits_controller.rb
+3
-0
spec/features/commits_spec.rb
spec/features/commits_spec.rb
+18
-0
No files found.
app/controllers/projects/commits_controller.rb
View file @
ca9cedea
...
...
@@ -64,10 +64,13 @@ class Projects::CommitsController < Projects::ApplicationController
render_404
unless
@path
.
empty?
||
request
.
format
==
:atom
||
@repository
.
blob_at
(
@commit
.
id
,
@path
)
||
@repository
.
tree
(
@commit
.
id
,
@path
).
entries
.
present?
@limit
,
@offset
=
(
params
[
:limit
]
||
40
).
to_i
,
(
params
[
:offset
]
||
0
).
to_i
search
=
params
[
:search
]
author
=
params
[
:author
]
@commits
=
if
search
.
present?
@repository
.
find_commits_by_message
(
search
,
@ref
,
@path
,
@limit
,
@offset
)
elsif
author
.
present?
@repository
.
commits
(
@ref
,
author:
author
,
path:
@path
,
limit:
@limit
,
offset:
@offset
)
else
@repository
.
commits
(
@ref
,
path:
@path
,
limit:
@limit
,
offset:
@offset
)
end
...
...
spec/features/commits_spec.rb
View file @
ca9cedea
...
...
@@ -183,4 +183,22 @@ describe 'Commits' do
expect
(
find
(
'.js-project-refs-dropdown'
)).
to
have_content
branch_name
end
end
context
'viewing commits for an author'
do
let
(
:author_commit
)
{
project
.
repository
.
commits
(
nil
,
limit:
1
).
first
}
let
(
:author
)
{
"
#{
author_commit
.
author_name
}
<
#{
author_commit
.
author_email
}
>"
}
let
(
:commits
)
{
project
.
repository
.
commits
(
nil
,
author:
author
,
limit:
40
)
}
before
do
project
.
add_maintainer
(
user
)
sign_in
(
user
)
visit
project_commits_path
(
project
,
nil
,
author:
author
)
end
it
'includes the committed_date for each commit'
do
commits
.
each
do
|
commit
|
expect
(
page
).
to
have_content
(
"authored
#{
commit
.
authored_date
.
strftime
(
"%b %d, %Y"
)
}
"
)
end
end
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