提交 07fc79e7 编写于 作者: T Toon Claes

Handle `membership` in ProjectFinder

The ProjectFinder supports the `non_public` parameter. This can be used to find
only projects the user is member of.
上级 4fda13b6
...@@ -257,10 +257,6 @@ module API ...@@ -257,10 +257,6 @@ module API
# project helpers # project helpers
def filter_projects(projects) def filter_projects(projects)
if params[:membership]
projects = projects.merge(current_user.authorized_projects)
end
if params[:owned] if params[:owned]
projects = projects.merge(current_user.owned_projects) projects = projects.merge(current_user.owned_projects)
end end
......
...@@ -68,7 +68,10 @@ module API ...@@ -68,7 +68,10 @@ module API
end end
def present_projects(options = {}) def present_projects(options = {})
projects = ProjectsFinder.new(current_user: current_user).execute finder_params = {}
finder_params[:non_public] = true if params[:membership].present?
projects = ProjectsFinder.new(current_user: current_user, params: finder_params).execute
projects = filter_projects(projects) projects = filter_projects(projects)
projects = projects.with_statistics if params[:statistics] projects = projects.with_statistics if params[:statistics]
projects = projects.with_issues_enabled if params[:with_issues_enabled] projects = projects.with_issues_enabled if params[:with_issues_enabled]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册