From 6b92236eeb74fa9854165c498a80f52e25e60e18 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Mon, 23 Mar 2015 16:43:08 +0100 Subject: Don't include system notes in issue/MR comment count. --- CHANGELOG | 1 + app/models/note.rb | 1 + app/views/projects/commits/_commit.html.haml | 2 +- app/views/projects/issues/_issue.html.haml | 5 +++-- app/views/projects/merge_requests/_merge_request.html.haml | 5 +++-- app/views/projects/merge_requests/_show.html.haml | 2 +- lib/gitlab/project_search_results.rb | 2 +- 7 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index c8b2dd2ba77..d824e871bc4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -27,6 +27,7 @@ v 7.10.0 (unreleased) - Restrict permissions on backup files - Improve oauth accounts UI in profile page - Add ability to unlink connected accounts + - Don't include system notes in issue/MR comment count. v 7.9.0 - Add HipChat integration documentation (Stan Hu) diff --git a/app/models/note.rb b/app/models/note.rb index 27b583a869a..e86160e7cd9 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -48,6 +48,7 @@ class Note < ActiveRecord::Base scope :inline, ->{ where("line_code IS NOT NULL") } scope :not_inline, ->{ where(line_code: [nil, '']) } scope :system, ->{ where(system: true) } + scope :user, ->{ where(system: false) } scope :common, ->{ where(noteable_type: ["", nil]) } scope :fresh, ->{ order(created_at: :asc, id: :asc) } scope :inc_author_project, ->{ includes(:project, :author) } diff --git a/app/views/projects/commits/_commit.html.haml b/app/views/projects/commits/_commit.html.haml index 4c853f577e9..c6026f96804 100644 --- a/app/views/projects/commits/_commit.html.haml +++ b/app/views/projects/commits/_commit.html.haml @@ -13,7 +13,7 @@ - note_count = @note_counts.fetch(commit.id, 0) - else - notes = project.notes.for_commit_id(commit.id) - - note_count = notes.count + - note_count = notes.user.count - if note_count > 0 %span.light diff --git a/app/views/projects/issues/_issue.html.haml b/app/views/projects/issues/_issue.html.haml index 7b06fe72882..998e74d12cf 100644 --- a/app/views/projects/issues/_issue.html.haml +++ b/app/views/projects/issues/_issue.html.haml @@ -10,11 +10,12 @@ - if issue.closed? %span CLOSED - - if issue.notes.any? + - note_count = issue.notes.user.count + - if note_count > 0   %span %i.fa.fa-comments - = issue.notes.count + = note_count .issue-info = link_to "##{issue.iid}", issue_path(issue), class: "light" diff --git a/app/views/projects/merge_requests/_merge_request.html.haml b/app/views/projects/merge_requests/_merge_request.html.haml index ecbff722b42..4f30d1e69f7 100644 --- a/app/views/projects/merge_requests/_merge_request.html.haml +++ b/app/views/projects/merge_requests/_merge_request.html.haml @@ -16,11 +16,12 @@ %span.label-branch< %i.fa.fa-code-fork %span= merge_request.target_branch - - if merge_request.notes.any? + - note_count = merge_request.mr_and_commit_notes.user.count + - if note_count > 0   %span %i.fa.fa-comments - = merge_request.mr_and_commit_notes.count + = note_count .merge-request-info = link_to "##{merge_request.iid}", merge_request_path(merge_request), class: "light" - if merge_request.assignee diff --git a/app/views/projects/merge_requests/_show.html.haml b/app/views/projects/merge_requests/_show.html.haml index ca4ceecb225..a74aede4e6b 100644 --- a/app/views/projects/merge_requests/_show.html.haml +++ b/app/views/projects/merge_requests/_show.html.haml @@ -40,7 +40,7 @@ = link_to merge_request_path(@merge_request) do %i.fa.fa-comments Discussion - %span.badge= @merge_request.mr_and_commit_notes.count + %span.badge= @merge_request.mr_and_commit_notes.user.count %li.commits-tab{data: {action: 'commits'}} = link_to merge_request_path(@merge_request), title: 'Commits' do %i.fa.fa-history diff --git a/lib/gitlab/project_search_results.rb b/lib/gitlab/project_search_results.rb index 8b85f3da83f..0dab7bcfa4d 100644 --- a/lib/gitlab/project_search_results.rb +++ b/lib/gitlab/project_search_results.rb @@ -67,7 +67,7 @@ module Gitlab end def notes - Note.where(project_id: limit_project_ids).search(query).order('updated_at DESC') + Note.where(project_id: limit_project_ids).user.search(query).order('updated_at DESC') end def limit_project_ids -- cgit v1.2.1 From 61700f619c61fd2b7b56259097c03e1cfe66444a Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 23 Mar 2015 09:38:52 -0700 Subject: Fix file mode going to next line in diff header --- app/assets/stylesheets/pages/diff.scss | 10 +++++----- app/views/projects/diffs/_file.html.haml | 13 +++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/app/assets/stylesheets/pages/diff.scss b/app/assets/stylesheets/pages/diff.scss index 7b7bb88bc20..af6ea58382f 100644 --- a/app/assets/stylesheets/pages/diff.scss +++ b/app/assets/stylesheets/pages/diff.scss @@ -15,6 +15,11 @@ word-break: break-all; margin-right: 200px; display: block; + + .file-mode { + margin-left: 10px; + color: #777; + } } .diff-btn-group { @@ -34,11 +39,6 @@ font-family: $monospace_font; font-size: smaller; } - - .file-mode { - font-family: $monospace_font; - margin-left: 10px; - } } .diff-content { overflow: auto; diff --git a/app/views/projects/diffs/_file.html.haml b/app/views/projects/diffs/_file.html.haml index 860ab096341..672a6635321 100644 --- a/app/views/projects/diffs/_file.html.haml +++ b/app/views/projects/diffs/_file.html.haml @@ -13,12 +13,13 @@ - submodule_item = project.repository.blob_at(@commit.id, diff_file.file_path) = submodule_link(submodule_item, @commit.id) - else - - if diff_file.renamed_file - %span= "#{diff_file.old_path} renamed to #{diff_file.new_path}" - - else - %span= diff_file.new_path - - if diff_file.mode_changed? - %span.file-mode= "#{diff_file.diff.a_mode} → #{diff_file.diff.b_mode}" + %span + - if diff_file.renamed_file + = "#{diff_file.old_path} renamed to #{diff_file.new_path}" + - else + = diff_file.new_path + - if diff_file.mode_changed? + %span.file-mode= "#{diff_file.diff.a_mode} → #{diff_file.diff.b_mode}" .diff-btn-group - if blob.text? -- cgit v1.2.1 From f039e8e03fb341e0cdca1c2597438549c84e15f1 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Mon, 23 Mar 2015 21:20:48 +0100 Subject: Don't use required keyword arguments to maintain support for Ruby 2.0. --- app/mailers/emails/projects.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/mailers/emails/projects.rb b/app/mailers/emails/projects.rb index 48458baa674..3cd812825e2 100644 --- a/app/mailers/emails/projects.rb +++ b/app/mailers/emails/projects.rb @@ -16,13 +16,17 @@ module Emails subject: subject("Project was moved")) end - def repository_push_email(project_id, recipient, author_id:, - ref:, - action:, + def repository_push_email(project_id, recipient, author_id: nil, + ref: nil, + action: nil, compare: nil, reverse_compare: false, send_from_committer_email: false, disable_diffs: false) + unless author_id && ref && action + raise ArgumentError, "missing keywords: author_id, ref, action" + end + @project = Project.find(project_id) @author = User.find(author_id) @reverse_compare = reverse_compare -- cgit v1.2.1 From 8a7b4eeb0e547251e97b7fd466de009dcbd7fe37 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Mon, 23 Mar 2015 21:21:23 +0100 Subject: Revert "Update gemnasium-gitlab-service gem" This reverts commit af522ede14cad4605bc7f0137ddf6950974eccce. --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 4f1cab43dd5..513e2c643e6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -188,7 +188,7 @@ GEM dotenv (>= 0.7) thor (>= 0.13.6) formatador (0.2.4) - gemnasium-gitlab-service (0.2.5) + gemnasium-gitlab-service (0.2.4) rugged (~> 0.21) gemojione (2.0.0) json -- cgit v1.2.1