summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-04-15 07:58:29 +0000
committerRémy Coutable <remy@rymai.me>2016-04-15 07:58:29 +0000
commit4e2f068c5fd7505be0674546ac977977152d3800 (patch)
tree259e9e4ab8ec094842f5bc7bbd5d1aff762242b5
parent447a9050888c9712db847d4c52bc9977926faa2e (diff)
parent5bf47f14b962b0e676e399dddc238d7bf764304d (diff)
downloadgitlab-ce-4e2f068c5fd7505be0674546ac977977152d3800.tar.gz
Merge branch 'i_14431_award_emoji_count_not_in_comment_count' into 'master'
Do not include award emojis in issue view comment_count ## What does this MR do? Fixes Issue #14431, changing comment_count on issues index view to not include award emoji comments. While including them is technically correct, it feel nonintuitive in the way comments are presented. ## Are there points in the code the reviewer needs to double check? No ## Why was this MR needed? Improves UX of issues view ## What are the relevant issue numbers? #14431 ## Screenshots ### Before - ![Issues before](https://monosnap.com/file/cs7lcEkcChXXvAV22y2gh7gBFWCWjj.png) - ![MR before](https://monosnap.com/file/qzOawShznyXMKK3Z5cij4SKrHO4jNy.png) ### After - ![Issues after](https://monosnap.com/file/IWMedIiGnDnCly7zI5BwNTYQuCS8fH.png) - ![MR after](https://monosnap.com/file/mXJu1C2OVo5DGK0XdD67vPZGNPAw4L.png) See merge request !3610
-rw-r--r--CHANGELOG1
-rw-r--r--app/views/projects/issues/_issue.html.haml2
-rw-r--r--app/views/projects/merge_requests/_merge_request.html.haml2
-rw-r--r--app/views/projects/merge_requests/_show.html.haml2
-rw-r--r--spec/features/issues_spec.rb16
-rw-r--r--spec/features/notes_on_merge_requests_spec.rb25
6 files changed, 43 insertions, 5 deletions
diff --git a/CHANGELOG b/CHANGELOG
index bb3fe90729a..5c34a8c579d 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -8,6 +8,7 @@ v 8.7.0 (unreleased)
- Loading of an issue's referenced merge requests and related branches is now done asynchronously (Yorick Peterse)
- Enable gzip for assets, makes the page size significantly smaller. !3544 / !3632 (Connor Shea)
- Load award emoji images separately unless opening the full picker. Saves several hundred KBs of data for most pages. (Connor Shea)
+ - Do not include award_emojis in issue and merge_request comment_count !3610 (Lucas Charles)
- All images in discussions and wikis now link to their source files !3464 (Connor Shea).
- Return status code 303 after a branch DELETE operation to avoid project deletion (Stan Hu)
- Add setting for customizing the list of trusted proxies !3524
diff --git a/app/views/projects/issues/_issue.html.haml b/app/views/projects/issues/_issue.html.haml
index 4aa92d0b39e..7a8009f6da4 100644
--- a/app/views/projects/issues/_issue.html.haml
+++ b/app/views/projects/issues/_issue.html.haml
@@ -27,7 +27,7 @@
= icon('thumbs-down')
= downvotes
- - note_count = issue.notes.user.count
+ - note_count = issue.notes.user.nonawards.count
- if note_count > 0
%li
= link_to issue_path(issue) + "#notes" do
diff --git a/app/views/projects/merge_requests/_merge_request.html.haml b/app/views/projects/merge_requests/_merge_request.html.haml
index 391193eed6c..e740fe8c84d 100644
--- a/app/views/projects/merge_requests/_merge_request.html.haml
+++ b/app/views/projects/merge_requests/_merge_request.html.haml
@@ -35,7 +35,7 @@
= icon('thumbs-down')
= downvotes
- - note_count = merge_request.mr_and_commit_notes.user.count
+ - note_count = merge_request.mr_and_commit_notes.user.nonawards.count
- if note_count > 0
%li
= link_to merge_request_path(merge_request) + "#notes" do
diff --git a/app/views/projects/merge_requests/_show.html.haml b/app/views/projects/merge_requests/_show.html.haml
index 1dd8f721f7e..07037a14f51 100644
--- a/app/views/projects/merge_requests/_show.html.haml
+++ b/app/views/projects/merge_requests/_show.html.haml
@@ -51,7 +51,7 @@
%li.notes-tab
= link_to namespace_project_merge_request_path(@project.namespace, @project, @merge_request), data: {target: 'div#notes', action: 'notes', toggle: 'tab'} do
Discussion
- %span.badge= @merge_request.mr_and_commit_notes.user.count
+ %span.badge= @merge_request.mr_and_commit_notes.user.nonawards.count
%li.commits-tab
= link_to commits_namespace_project_merge_request_path(@project.namespace, @project, @merge_request), data: {target: 'div#commits', action: 'commits', toggle: 'tab'} do
Commits
diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb
index 79000666ccc..1ce0024e93c 100644
--- a/spec/features/issues_spec.rb
+++ b/spec/features/issues_spec.rb
@@ -45,7 +45,7 @@ describe 'Issues', feature: true do
project: project)
end
- it 'allows user to select unasigned', js: true do
+ it 'allows user to select unassigned', js: true do
visit edit_namespace_project_issue_path(project.namespace, project, issue)
expect(page).to have_content "Assignee #{@user.name}"
@@ -64,6 +64,18 @@ describe 'Issues', feature: true do
end
end
+ describe 'Issue info' do
+ it 'excludes award_emoji from comment count' do
+ issue = create(:issue, author: @user, assignee: @user, project: project, title: 'foobar')
+ create(:upvote_note, noteable: issue)
+
+ visit namespace_project_issues_path(project.namespace, project, assignee_id: @user.id)
+
+ expect(page).to have_content 'foobar'
+ expect(page.all('.issue-no-comments').first.text).to eq "0"
+ end
+ end
+
describe 'Filter issue' do
before do
['foobar', 'barbaz', 'gitlab'].each do |title|
@@ -187,7 +199,7 @@ describe 'Issues', feature: true do
describe 'update assignee from issue#show' do
let(:issue) { create(:issue, project: project, author: @user, assignee: @user) }
- context 'by autorized user' do
+ context 'by authorized user' do
it 'allows user to select unassigned', js: true do
visit namespace_project_issue_path(project.namespace, project, issue)
diff --git a/spec/features/notes_on_merge_requests_spec.rb b/spec/features/notes_on_merge_requests_spec.rb
index 5f855ccc701..389812ff7e1 100644
--- a/spec/features/notes_on_merge_requests_spec.rb
+++ b/spec/features/notes_on_merge_requests_spec.rb
@@ -4,6 +4,20 @@ describe 'Comments', feature: true do
include RepoHelpers
include WaitForAjax
+ describe 'On merge requests page', feature: true do
+ it 'excludes award_emoji from comment count' do
+ merge_request = create(:merge_request)
+ project = merge_request.source_project
+ create(:upvote_note, noteable: merge_request, project: project)
+
+ login_as :admin
+ visit namespace_project_merge_requests_path(project.namespace, project)
+
+ expect(merge_request.mr_and_commit_notes.count).to eq 1
+ expect(page.all('.merge-request-no-comments').first.text).to eq "0"
+ end
+ end
+
describe 'On a merge request', js: true, feature: true do
let!(:merge_request) { create(:merge_request) }
let!(:project) { merge_request.source_project }
@@ -129,6 +143,17 @@ describe 'Comments', feature: true do
end
end
end
+
+ describe 'comment info' do
+ it 'excludes award_emoji from comment count' do
+ create(:upvote_note, noteable: merge_request, project: project)
+
+ visit namespace_project_merge_request_path(project.namespace, project, merge_request)
+
+ expect(merge_request.mr_and_commit_notes.count).to eq 2
+ expect(find('.notes-tab span.badge').text).to eq "1"
+ end
+ end
end
describe 'On a merge request diff', js: true, feature: true do