summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2018-01-09 17:23:33 -0200
committerFelipe Artur <felipefac@gmail.com>2018-01-09 17:23:33 -0200
commitbc192dfa986b6e1d39d56db2e57c23cb573adce5 (patch)
tree46d9932a887f34125f9a3b6029de51c7905d42f0
parent4b92efd90cedaa0aff218d11fdce279701128bea (diff)
downloadgitlab-ce-issue_38067.tar.gz
-rw-r--r--app/views/projects/diffs/_diffs.html.haml10
-rw-r--r--db/fixtures/development/22_merge_request_with_notes.rb48
2 files changed, 53 insertions, 5 deletions
diff --git a/app/views/projects/diffs/_diffs.html.haml b/app/views/projects/diffs/_diffs.html.haml
index 376f672f424..273dc3a4dc7 100644
--- a/app/views/projects/diffs/_diffs.html.haml
+++ b/app/views/projects/diffs/_diffs.html.haml
@@ -1,14 +1,14 @@
- environment = local_assigns.fetch(:environment, nil)
- show_whitespace_toggle = local_assigns.fetch(:show_whitespace_toggle, true)
- can_create_note = !@diff_notes_disabled && can?(current_user, :create_note, diffs.project)
-- diff_files = diffs.diff_files
+-# diff_files = diffs.diff_files
- merge_request = local_assigns.fetch(:merge_request, false)
.content-block.oneline-block.files-changed.diff-files-changed.js-diff-files-changed{ class: ("diff-files-changed-merge-request" if merge_request) }
.files-changed-inner
.inline-parallel-buttons.hidden-xs.hidden-sm
- - if !diffs_expanded? && diff_files.any? { |diff_file| diff_file.collapsed? }
- = link_to 'Expand all', url_for(params.merge(expanded: 1, format: nil)), class: 'btn btn-default'
+ / - if !diffs_expanded? && diff_files.any? { |diff_file| diff_file.collapsed? }
+ / = link_to 'Expand all', url_for(params.merge(expanded: 1, format: nil)), class: 'btn btn-default'
- if show_whitespace_toggle
- if current_controller?(:commit)
= commit_diff_whitespace_link(diffs.project, @commit, class: 'hidden-xs')
@@ -19,10 +19,10 @@
.btn-group
= inline_diff_btn
= parallel_diff_btn
- = render 'projects/diffs/stats', diff_files: diff_files
+ / = render 'projects/diffs/stats', diff_files: diff_files
- if render_overflow_warning?(diff_files)
= render 'projects/diffs/warning', diff_files: diffs
.files{ data: { can_create_note: can_create_note } }
- = render partial: 'projects/diffs/file', collection: diff_files, as: :diff_file, locals: { project: diffs.project, environment: environment }
+ / = render partial: 'projects/diffs/file', collection: diff_files, as: :diff_file, locals: { project: diffs.project, environment: environment }
diff --git a/db/fixtures/development/22_merge_request_with_notes.rb b/db/fixtures/development/22_merge_request_with_notes.rb
new file mode 100644
index 00000000000..f6e02289af2
--- /dev/null
+++ b/db/fixtures/development/22_merge_request_with_notes.rb
@@ -0,0 +1,48 @@
+Gitlab::Seeder.quiet do
+ project = Project.find_by_title('notes_sandbox')
+ users = User.limit(20)
+ users.each { |user| project.add_developer(user) }
+
+ 1.upto(100) do |line|
+ user = users.sample
+ commit_id ="ae90a6e538c8bbda7c46523dd767d3f83fb967ea"
+
+ # Create first note
+ note_type = line.even? ? "DiffNote" : "LegacyDiffNote"
+
+ note_params = {
+ noteable_type: "Commit",
+ commit_id: commit_id,
+ type: note_type,
+ note: FFaker::Lorem.sentence,
+ line_code: "0398ccd0f49298b10a3d76a47800d2ebecd49859_0_#{line}",
+
+ position: {
+ base_sha: "0000000000000000000000000000000000000000",
+ start_sha: "0000000000000000000000000000000000000000",
+ head_sha: "ae90a6e538c8bbda7c46523dd767d3f83fb967ea",
+ old_path: "LICENSE",
+ new_path: "LICENSE",
+ position_type: "text",
+ old_line: nil,
+ new_line: line
+ }.to_json
+ }.with_indifferent_access
+
+ note = Notes::CreateService.new(project, user, note_params).execute
+
+ # Create 10 replies
+ commit = project.repository.commit(commit_id)
+ in_reply_to_discussion_id = note.discussion_id(commit)
+ note_params[:position] = ""
+ note_params[:line_code] = ""
+ note_params[:in_reply_to_discussion_id] = in_reply_to_discussion_id
+
+ 5.times do
+ note_params[:note] = FFaker::Lorem.sentence
+ Notes::CreateService.new(project, project.users.sample, note_params).execute
+ end
+
+ print '.'
+ end
+end