gitlab-org--gitlab-foss/app/controllers/autocomplete_controller.rb
gfyoung 73322a0e55 Enable frozen string in app/controllers/**/*.rb
Enables frozen string for the following:

* app/controllers/*.rb
* app/controllers/admin/**/*.rb
* app/controllers/boards/**/*.rb
* app/controllers/ci/**/*.rb
* app/controllers/concerns/**/*.rb

Partially addresses #47424.
2018-09-18 21:22:45 -07:00

41 lines
1 KiB
Ruby

# frozen_string_literal: true
class AutocompleteController < ApplicationController
skip_before_action :authenticate_user!, only: [:users, :award_emojis]
def users
project = Autocomplete::ProjectFinder
.new(current_user, params)
.execute
group = Autocomplete::GroupFinder
.new(current_user, project, params)
.execute
users = Autocomplete::UsersFinder
.new(params: params, current_user: current_user, project: project, group: group)
.execute
render json: UserSerializer.new.represent(users)
end
def user
user = UserFinder.new(params).execute!
render json: UserSerializer.new.represent(user)
end
# Displays projects to use for the dropdown when moving a resource from one
# project to another.
def projects
projects = Autocomplete::MoveToProjectFinder
.new(current_user, params)
.execute
render json: MoveToProjectSerializer.new.represent(projects)
end
def award_emojis
render json: AwardedEmojiFinder.new(current_user).execute
end
end