From 5179c5830bb3d8602eb25cc00f53be697c6010ac Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Tue, 24 Feb 2015 16:28:40 +0100 Subject: [PATCH] Contributed projects either have user pushes or created MRs. --- app/models/user.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 21ccc76978e..0c133f0e1e0 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -618,9 +618,10 @@ class User < ActiveRecord::Base def contributed_projects_ids Event.where(author_id: self). where("created_at > ?", Time.now - 1.year). - code_push. + where("action = :pushed OR (target_type = 'MergeRequest' AND action = :created)", + pushed: Event::PUSHED, created: Event::CREATED). reorder(project_id: :desc). - select('DISTINCT(project_id)'). - map(&:project_id) + select(:project_id). + uniq end end -- GitLab