debian-mirror-gitlab/app/finders/starred_projects_finder.rb

23 lines
501 B
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
class StarredProjectsFinder < ProjectsFinder
2020-12-08 15:28:05 +05:30
include Gitlab::Allowable
2019-10-12 21:52:04 +05:30
def initialize(user, params: {}, current_user: nil)
2020-12-08 15:28:05 +05:30
@user = user
2019-10-12 21:52:04 +05:30
super(
params: params,
current_user: current_user,
project_ids_relation: user.starred_projects.select(:id)
)
end
2020-12-08 15:28:05 +05:30
def execute
# Do not show starred projects if the user has a private profile.
return Project.none unless can?(current_user, :read_user_profile, @user)
super
end
2019-10-12 21:52:04 +05:30
end