2019-01-27 05:18:09 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-01-28 13:02:03 -05:00
|
|
|
class StarredProjectsFinder < ProjectsFinder
|
2020-12-07 16:10:08 -05:00
|
|
|
include Gitlab::Allowable
|
|
|
|
|
2019-01-28 13:02:03 -05:00
|
|
|
def initialize(user, params: {}, current_user: nil)
|
2020-12-07 16:10:08 -05:00
|
|
|
@user = user
|
|
|
|
|
2019-08-03 06:57:33 -04:00
|
|
|
super(
|
|
|
|
params: params,
|
|
|
|
current_user: current_user,
|
|
|
|
project_ids_relation: user.starred_projects.select(:id)
|
|
|
|
)
|
2019-01-27 05:18:09 -05:00
|
|
|
end
|
2020-12-07 16:10:08 -05:00
|
|
|
|
|
|
|
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-01-27 05:18:09 -05:00
|
|
|
end
|