BaseContext

Controllers refactoring with contexts
Move commit compare logic to model
This commit is contained in:
Dmitriy Zaporozhets 2012-07-20 08:39:34 +03:00
parent 3c6daec4b1
commit 3063af5adc
11 changed files with 130 additions and 62 deletions

View file

@ -40,25 +40,6 @@ class NotesController < ApplicationController
protected
def notes
@notes = case params[:target_type]
when "commit"
then project.commit_notes(project.commit((params[:target_id]))).fresh.limit(20)
when "snippet"
then project.snippets.find(params[:target_id]).notes
when "wall"
then project.common_notes.order("created_at DESC").fresh.limit(50)
when "issue"
then project.issues.find(params[:target_id]).notes.inc_author.order("created_at DESC").limit(20)
when "merge_request"
then project.merge_requests.find(params[:target_id]).notes.inc_author.order("created_at DESC").limit(20)
end
@notes = if params[:last_id]
@notes.where("id > ?", params[:last_id])
elsif params[:first_id]
@notes.where("id < ?", params[:first_id])
else
@notes
end
@notes = NotesLoad.new(project, current_user, params).execute
end
end