Filter commits by search parameter
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
61561a9eeb
commit
9a250ad6d8
|
@ -8,10 +8,16 @@ class Projects::CommitsController < Projects::ApplicationController
|
|||
before_action :authorize_download_code!
|
||||
|
||||
def show
|
||||
@repo = @project.repository
|
||||
@limit, @offset = (params[:limit] || 40).to_i, (params[:offset] || 0).to_i
|
||||
search = params[:search]
|
||||
|
||||
@commits =
|
||||
if search.present?
|
||||
@repository.find_commits_by_message(search).compact
|
||||
else
|
||||
@repository.commits(@ref, @path, @limit, @offset)
|
||||
end
|
||||
|
||||
@commits = @repo.commits(@ref, @path, @limit, @offset)
|
||||
@note_counts = project.notes.where(commit_id: @commits.map(&:id)).
|
||||
group(:commit_id).count
|
||||
|
||||
|
|
Loading…
Reference in New Issue