diff options
author | Felipe Artur <felipefac@gmail.com> | 2016-03-16 20:16:42 -0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2016-03-16 20:16:42 -0300 |
commit | 44c127447b5a3cfc7aaea6f19e18baf9f42ad500 (patch) | |
tree | f386dbb06fec8c5fdec92812394ac63cf67183a0 /app/finders | |
parent | ec20fdf366843e60ed30abb5322c3c1b8f471b4a (diff) | |
parent | 59064aeeef8562a87d4d03efa9b11012a007e261 (diff) | |
download | gitlab-ce-44c127447b5a3cfc7aaea6f19e18baf9f42ad500.tar.gz |
Merge 4009-external-users into issue_12658
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/issuable_finder.rb | 7 | ||||
-rw-r--r-- | app/finders/projects_finder.rb | 23 |
2 files changed, 21 insertions, 9 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 3b4e0362e04..3a5fc5b5907 100644 --- a/app/finders/projects_finder.rb +++ b/app/finders/projects_finder.rb @@ -40,21 +40,26 @@ class ProjectsFinder private def group_projects(current_user, group) - if current_user - [ - group_projects_for_user(current_user, group), - group.projects.public_and_internal_only - ] + 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? + user_group_projects << group.projects.public_only else - [group.projects.public_only] + user_group_projects << group.projects.public_and_internal_only end end def all_projects(current_user) - if current_user - [current_user.authorized_projects, public_and_internal_projects] + return [public_projects] unless current_user + + if current_user.external? + [current_user.authorized_projects, public_projects] else - [Project.public_only] + [current_user.authorized_projects, public_and_internal_projects] end end |