summaryrefslogtreecommitdiff
path: root/app/finders
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <zegerjan@gitlab.com>2016-03-14 20:08:02 +0100
committerZeger-Jan van de Weg <zegerjan@gitlab.com>2016-03-14 20:08:02 +0100
commit88f8d3a4d6521d1001bcea83c2fb7b7c4fe15f37 (patch)
tree6396220c786e65563c8d0eb4dc1a88a60d3636c8 /app/finders
parent76eeb316df2f256d0d3c41d97421f709a21a02a8 (diff)
parentb782e7c9732275175d79b485fcddc85e575d48dd (diff)
downloadgitlab-ce-88f8d3a4d6521d1001bcea83c2fb7b7c4fe15f37.tar.gz
Merge branch 'master' into 4009-external-users
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/issuable_finder.rb7
-rw-r--r--app/finders/projects_finder.rb14
2 files changed, 13 insertions, 8 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb
index c88a420b412..19e8c7a92be 100644
--- a/app/finders/issuable_finder.rb
+++ b/app/finders/issuable_finder.rb
@@ -244,10 +244,17 @@ class IssuableFinder
items
end
+ def filter_by_upcoming_milestone?
+ params[:milestone_title] == '#upcoming'
+ end
+
def by_milestone(items)
if milestones?
if filter_by_no_milestone?
items = items.where(milestone_id: [-1, nil])
+ elsif filter_by_upcoming_milestone?
+ upcoming = Milestone.where(project_id: projects).upcoming
+ items = items.joins(:milestone).where(milestones: { title: upcoming.title })
else
items = items.joins(:milestone).where(milestones: { title: params[:milestone_title] })
diff --git a/app/finders/projects_finder.rb b/app/finders/projects_finder.rb
index 4a6c2fbd71c..70c073f7d5c 100644
--- a/app/finders/projects_finder.rb
+++ b/app/finders/projects_finder.rb
@@ -42,16 +42,14 @@ class ProjectsFinder
def group_projects(current_user, group)
return [group.projects.public_only] unless current_user
+ user_group_projects = [
+ group_projects_for_user(current_user, group),
+ group.shared_projects.visible_to_user(current_user)
+ ]
if current_user.external?
- [
- group_projects_for_user(current_user, group),
- group.projects.public_only
- ]
+ user_group_projects.push(group.projects.public_only)
else
- [
- group_projects_for_user(current_user, group),
- group.projects.public_and_internal_only
- ]
+ user_group_projects.push(group.projects.public_and_internal_only)
end
end