Merge commit 'master' into discussions
Conflicts: app/assets/stylesheets/sections/notes.scss app/contexts/notes/load_context.rb app/models/project.rb app/observers/note_observer.rb app/roles/votes.rb app/views/commit/show.html.haml app/views/merge_requests/_show.html.haml app/views/merge_requests/diffs.js.haml app/views/merge_requests/show.js.haml app/views/notes/_note.html.haml features/steps/project/project_merge_requests.rb spec/models/note_spec.rb
This commit is contained in:
commit
3022786948
930 changed files with 80374 additions and 103682 deletions
|
@ -9,16 +9,16 @@ class CommitLoadContext < BaseContext
|
|||
status: :ok
|
||||
}
|
||||
|
||||
commit = project.commit(params[:id])
|
||||
commit = project.repository.commit(params[:id])
|
||||
|
||||
if commit
|
||||
commit = CommitDecorator.decorate(commit)
|
||||
line_notes = project.commit_line_notes(commit)
|
||||
line_notes = project.notes.for_commit_id(commit.id).inline
|
||||
|
||||
result[:commit] = commit
|
||||
result[:note] = project.build_commit_note(commit)
|
||||
result[:line_notes] = line_notes
|
||||
result[:notes_count] = line_notes.count + project.commit_notes(commit).count
|
||||
result[:notes_count] = project.notes.for_commit_id(commit.id).count
|
||||
|
||||
begin
|
||||
result[:suppress_diff] = true if commit.diffs.size > Commit::DIFF_SAFE_SIZE && !params[:force_show_diff]
|
||||
|
|
31
app/contexts/filter_context.rb
Normal file
31
app/contexts/filter_context.rb
Normal file
|
@ -0,0 +1,31 @@
|
|||
class FilterContext
|
||||
attr_accessor :items, :params
|
||||
|
||||
def initialize(items, params)
|
||||
@items = items
|
||||
@params = params
|
||||
end
|
||||
|
||||
def execute
|
||||
apply_filter(items)
|
||||
end
|
||||
|
||||
def apply_filter items
|
||||
if params[:project_id]
|
||||
items = items.where(project_id: params[:project_id])
|
||||
end
|
||||
|
||||
if params[:search].present?
|
||||
items = items.search(params[:search])
|
||||
end
|
||||
|
||||
case params[:status]
|
||||
when 'closed'
|
||||
items.closed
|
||||
when 'all'
|
||||
items
|
||||
else
|
||||
items.opened
|
||||
end
|
||||
end
|
||||
end
|
|
@ -4,7 +4,7 @@ class IssuesListContext < BaseContext
|
|||
attr_accessor :issues
|
||||
|
||||
def execute
|
||||
@issues = case params[:f]
|
||||
@issues = case params[:status]
|
||||
when issues_filter[:all] then @project.issues
|
||||
when issues_filter[:closed] then @project.issues.closed
|
||||
when issues_filter[:to_me] then @project.issues.opened.assigned(current_user)
|
||||
|
|
|
@ -9,7 +9,7 @@ module Notes
|
|||
|
||||
@notes = case target_type
|
||||
when "commit"
|
||||
project.commit_notes(project.commit(target_id)).fresh
|
||||
project.notes.for_commit_id(target_id).not_inline.fresh
|
||||
when "issue"
|
||||
project.issues.find(target_id).notes.inc_author.fresh
|
||||
when "merge_request"
|
||||
|
@ -18,7 +18,7 @@ module Notes
|
|||
project.snippets.find(target_id).notes.fresh
|
||||
when "wall"
|
||||
# this is the only case, where the order is DESC
|
||||
project.common_notes.order("created_at DESC, id DESC").limit(50)
|
||||
project.notes.common.inc_author_project.order("created_at DESC, id DESC").limit(50)
|
||||
end
|
||||
|
||||
@notes = if after_id
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class TestHookContext < BaseContext
|
||||
def execute
|
||||
hook = project.hooks.find(params[:id])
|
||||
commits = project.commits(project.default_branch, nil, 3)
|
||||
commits = project.repository.commits(project.default_branch, nil, 3)
|
||||
data = project.post_receive_data(commits.last.id, commits.first.id, "refs/heads/#{project.default_branch}", current_user)
|
||||
hook.execute(data)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue