diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-03-24 03:10:25 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-03-24 03:10:25 +0300 |
commit | 2bb4ea854228c3c9660d5cb55f59e2cafd1f33ec (patch) | |
tree | fcfa3e96f7ecd7a3c229db5b31fb8b8b102c8581 /app | |
parent | 2cd6cc7feda8dcb914093e57f331fc15d18a6602 (diff) | |
parent | 6b92236eeb74fa9854165c498a80f52e25e60e18 (diff) |
Merge branch 'notes-count-without-system' into 'master'
Don't include system notes in issue/MR comment count.
Addresses private issue https://dev.gitlab.org/gitlab/gitlabhq/issues/2163.
See merge request !430
Diffstat (limited to 'app')
-rw-r--r-- | app/models/note.rb | 1 | ||||
-rw-r--r-- | app/views/projects/commits/_commit.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/issues/_issue.html.haml | 5 | ||||
-rw-r--r-- | app/views/projects/merge_requests/_merge_request.html.haml | 5 | ||||
-rw-r--r-- | app/views/projects/merge_requests/_show.html.haml | 2 |
5 files changed, 9 insertions, 6 deletions
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 |