summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGeorge Tsiolis <tsiolis.g@gmail.com>2018-09-07 15:08:55 +0000
committerNick Thomas <nick@gitlab.com>2018-09-07 15:08:55 +0000
commit124cece3b39f5cc38686df39c179b1a61ecbd562 (patch)
tree3b5ea888156c05fe8cd6a6cab69cbd9721d565a7 /lib
parent272281e4729c9e2193acea84394a191cfe2496af (diff)
downloadgitlab-ce-124cece3b39f5cc38686df39c179b1a61ecbd562.tar.gz
Include private contributions in user contribution graph
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/contributions_calendar.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/gitlab/contributions_calendar.rb b/lib/gitlab/contributions_calendar.rb
index 4c28489f45a..58ca077e636 100644
--- a/lib/gitlab/contributions_calendar.rb
+++ b/lib/gitlab/contributions_calendar.rb
@@ -7,7 +7,11 @@ module Gitlab
def initialize(contributor, current_user = nil)
@contributor = contributor
@current_user = current_user
- @projects = ContributedProjectsFinder.new(contributor).execute(current_user)
+ @projects = if @contributor.include_private_contributions?
+ ContributedProjectsFinder.new(@contributor).execute(@contributor)
+ else
+ ContributedProjectsFinder.new(contributor).execute(current_user)
+ end
end
def activity_dates
@@ -36,13 +40,9 @@ module Gitlab
def events_by_date(date)
return Event.none unless can_read_cross_project?
- events = Event.contributions.where(author_id: contributor.id)
+ Event.contributions.where(author_id: contributor.id)
.where(created_at: date.beginning_of_day..date.end_of_day)
.where(project_id: projects)
-
- # Use visible_to_user? instead of the complicated logic in activity_dates
- # because we're only viewing the events for a single day.
- events.select { |event| event.visible_to_user?(current_user) }
end
def starting_year