blob: 3766b64a09154caecd497c0ef7cecfea51e8b3b4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# 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
|