Commit 2bb4ea85 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

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
parents 2cd6cc7f 6b92236e
...@@ -31,6 +31,7 @@ v 7.10.0 (unreleased) ...@@ -31,6 +31,7 @@ v 7.10.0 (unreleased)
- Replace commits calendar with faster contribution calendar that includes issues and merge requests - Replace commits calendar with faster contribution calendar that includes issues and merge requests
- Add inifinite scroll to user page activity - Add inifinite scroll to user page activity
- Don't show commit comment button when user is not signed in. - Don't show commit comment button when user is not signed in.
- Don't include system notes in issue/MR comment count.
v 7.9.0 v 7.9.0
- Send EmailsOnPush email when branch or tag is created or deleted. - Send EmailsOnPush email when branch or tag is created or deleted.
......
...@@ -48,6 +48,7 @@ class Note < ActiveRecord::Base ...@@ -48,6 +48,7 @@ class Note < ActiveRecord::Base
scope :inline, ->{ where("line_code IS NOT NULL") } scope :inline, ->{ where("line_code IS NOT NULL") }
scope :not_inline, ->{ where(line_code: [nil, '']) } scope :not_inline, ->{ where(line_code: [nil, '']) }
scope :system, ->{ where(system: true) } scope :system, ->{ where(system: true) }
scope :user, ->{ where(system: false) }
scope :common, ->{ where(noteable_type: ["", nil]) } scope :common, ->{ where(noteable_type: ["", nil]) }
scope :fresh, ->{ order(created_at: :asc, id: :asc) } scope :fresh, ->{ order(created_at: :asc, id: :asc) }
scope :inc_author_project, ->{ includes(:project, :author) } scope :inc_author_project, ->{ includes(:project, :author) }
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
- note_count = @note_counts.fetch(commit.id, 0) - note_count = @note_counts.fetch(commit.id, 0)
- else - else
- notes = project.notes.for_commit_id(commit.id) - notes = project.notes.for_commit_id(commit.id)
- note_count = notes.count - note_count = notes.user.count
- if note_count > 0 - if note_count > 0
%span.light %span.light
......
...@@ -10,11 +10,12 @@ ...@@ -10,11 +10,12 @@
- if issue.closed? - if issue.closed?
%span %span
CLOSED CLOSED
- if issue.notes.any? - note_count = issue.notes.user.count
- if note_count > 0
&nbsp; &nbsp;
%span %span
%i.fa.fa-comments %i.fa.fa-comments
= issue.notes.count = note_count
.issue-info .issue-info
= link_to "##{issue.iid}", issue_path(issue), class: "light" = link_to "##{issue.iid}", issue_path(issue), class: "light"
......
...@@ -16,11 +16,12 @@ ...@@ -16,11 +16,12 @@
%span.label-branch< %span.label-branch<
%i.fa.fa-code-fork %i.fa.fa-code-fork
%span= merge_request.target_branch %span= merge_request.target_branch
- if merge_request.notes.any? - note_count = merge_request.mr_and_commit_notes.user.count
- if note_count > 0
&nbsp; &nbsp;
%span %span
%i.fa.fa-comments %i.fa.fa-comments
= merge_request.mr_and_commit_notes.count = note_count
.merge-request-info .merge-request-info
= link_to "##{merge_request.iid}", merge_request_path(merge_request), class: "light" = link_to "##{merge_request.iid}", merge_request_path(merge_request), class: "light"
- if merge_request.assignee - if merge_request.assignee
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
= link_to merge_request_path(@merge_request) do = link_to merge_request_path(@merge_request) do
%i.fa.fa-comments %i.fa.fa-comments
Discussion 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'}} %li.commits-tab{data: {action: 'commits'}}
= link_to merge_request_path(@merge_request), title: 'Commits' do = link_to merge_request_path(@merge_request), title: 'Commits' do
%i.fa.fa-history %i.fa.fa-history
......
...@@ -67,7 +67,7 @@ module Gitlab ...@@ -67,7 +67,7 @@ module Gitlab
end end
def notes 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 end
def limit_project_ids def limit_project_ids
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment