Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2018-03-07 13:16:39 +0300
committerSean McGivern <sean@mcgivern.me.uk>2018-03-07 13:16:39 +0300
commit5d8d6dbde767d700e08cc913bee7d0c5ffad20b2 (patch)
tree5d450508890c9219f2e8e63a911f677aace80c31
parentcfe203fa3a77adbb33f877c98af5e117b1ccd281 (diff)
parente2bdce8defbbd5a11d50115e3d52498d90417ac2 (diff)
Merge branch 'include-mr-discussions-calendar-activity' into 'master'
Count discussions on issues and merge requests as contributions for the contributions calendar See merge request gitlab-org/gitlab-ce!17557
-rw-r--r--changelogs/unreleased/feature--43691-count-diff-note-calendar-activity.yml2
-rw-r--r--lib/gitlab/contributions_calendar.rb2
-rw-r--r--spec/lib/gitlab/contributions_calendar_spec.rb7
3 files changed, 9 insertions, 2 deletions
diff --git a/changelogs/unreleased/feature--43691-count-diff-note-calendar-activity.yml b/changelogs/unreleased/feature--43691-count-diff-note-calendar-activity.yml
index 768686aeda8..d8020592897 100644
--- a/changelogs/unreleased/feature--43691-count-diff-note-calendar-activity.yml
+++ b/changelogs/unreleased/feature--43691-count-diff-note-calendar-activity.yml
@@ -1,5 +1,5 @@
---
-title: Count comments on diffs as contributions for the contributions calendar
+title: Count comments on diffs and discussions as contributions for the contributions calendar
merge_request: 17418
author: Riccardo Padovani
type: fixed
diff --git a/lib/gitlab/contributions_calendar.rb b/lib/gitlab/contributions_calendar.rb
index 02d3763514e..d7369060cc5 100644
--- a/lib/gitlab/contributions_calendar.rb
+++ b/lib/gitlab/contributions_calendar.rb
@@ -23,7 +23,7 @@ module Gitlab
mr_events = event_counts(date_from, :merge_requests)
.having(action: [Event::MERGED, Event::CREATED, Event::CLOSED], target_type: "MergeRequest")
note_events = event_counts(date_from, :merge_requests)
- .having(action: [Event::COMMENTED], target_type: %w(Note DiffNote))
+ .having(action: [Event::COMMENTED])
union = Gitlab::SQL::Union.new([repo_events, issue_events, mr_events, note_events])
events = Event.find_by_sql(union.to_sql).map(&:attributes)
diff --git a/spec/lib/gitlab/contributions_calendar_spec.rb b/spec/lib/gitlab/contributions_calendar_spec.rb
index 167876ca158..2c63f3b0455 100644
--- a/spec/lib/gitlab/contributions_calendar_spec.rb
+++ b/spec/lib/gitlab/contributions_calendar_spec.rb
@@ -77,6 +77,13 @@ describe Gitlab::ContributionsCalendar do
expect(calendar(contributor).activity_dates[today]).to eq(1)
end
+ it "counts the discussions on merge requests and issues" do
+ create_event(public_project, today, 0, Event::COMMENTED, :discussion_note_on_merge_request)
+ create_event(public_project, today, 2, Event::COMMENTED, :discussion_note_on_issue)
+
+ expect(calendar(contributor).activity_dates[today]).to eq(2)
+ end
+
context "when events fall under different dates depending on the time zone" do
before do
create_event(public_project, today, 1)