Commit 2cedeb48 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'contributed-projects' into 'master'

Improve contributed project and commit calendar selection.

Fixes #2024.

See merge request !1554
parents d73a0589 5179c583
...@@ -6,7 +6,9 @@ class UsersController < ApplicationController ...@@ -6,7 +6,9 @@ class UsersController < ApplicationController
def show def show
@contributed_projects = Project. @contributed_projects = Project.
where(id: authorized_projects_ids & @user.contributed_projects_ids). where(id: authorized_projects_ids & @user.contributed_projects_ids).
in_group_namespace.includes(:namespace) in_group_namespace.
includes(:namespace).
reject(&:forked?)
@projects = @user.personal_projects. @projects = @user.personal_projects.
where(id: authorized_projects_ids).includes(:namespace) where(id: authorized_projects_ids).includes(:namespace)
......
...@@ -623,9 +623,10 @@ class User < ActiveRecord::Base ...@@ -623,9 +623,10 @@ class User < ActiveRecord::Base
def contributed_projects_ids def contributed_projects_ids
Event.where(author_id: self). Event.where(author_id: self).
where("created_at > ?", Time.now - 1.year). 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). reorder(project_id: :desc).
select('DISTINCT(project_id)'). select(:project_id).
map(&:project_id) uniq
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment