summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-02-24 16:28:40 +0100
committerDouwe Maan <douwe@gitlab.com>2015-02-24 18:13:11 +0100
commit5179c5830bb3d8602eb25cc00f53be697c6010ac (patch)
treee8326180537f6f167b2030a45c72a9599c9021dc
parent1bf9fa8c7fc027b5273c143949e57eac9bef52a4 (diff)
downloadgitlab-ce-5179c5830bb3d8602eb25cc00f53be697c6010ac.tar.gz
Contributed projects either have user pushes or created MRs.
-rw-r--r--app/models/user.rb7
1 files 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