diff options
author | Stan Hu <stanhu@gmail.com> | 2019-06-13 19:27:26 +0000 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-06-13 19:27:26 +0000 |
commit | 3db2e15b7235d2bfb002b46d85f37d3ae54876ec (patch) | |
tree | 105ab96aa450d05cc477949ce6c1eb63524d0090 /app/controllers | |
parent | 40d309cc7875ebb7c1178da6a088399266ce263b (diff) | |
parent | 0c29aa0da38104c4c65cbadcc40abe25e56693aa (diff) | |
download | gitlab-ce-3db2e15b7235d2bfb002b46d85f37d3ae54876ec.tar.gz |
Merge branch 'ce-3861-use-serializers-for-project-group-boards' into 'master'
Use serialization for project boards
See merge request gitlab-org/gitlab-ce!29263
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/concerns/boards_actions.rb | 8 | ||||
-rw-r--r-- | app/controllers/concerns/boards_responses.rb | 6 |
2 files changed, 13 insertions, 1 deletions
diff --git a/app/controllers/concerns/boards_actions.rb b/app/controllers/concerns/boards_actions.rb index ed7ea2f0e04..e4123d87137 100644 --- a/app/controllers/concerns/boards_actions.rb +++ b/app/controllers/concerns/boards_actions.rb @@ -35,4 +35,12 @@ module BoardsActions boards.find(params[:id]) end end + + def serializer + BoardSerializer.new(current_user: current_user) + end + + def serialize_as_json(resource) + serializer.represent(resource, serializer: 'board', include_full_project_path: board.group_board?) + end end diff --git a/app/controllers/concerns/boards_responses.rb b/app/controllers/concerns/boards_responses.rb index 8b191c86397..7625600e452 100644 --- a/app/controllers/concerns/boards_responses.rb +++ b/app/controllers/concerns/boards_responses.rb @@ -69,7 +69,7 @@ module BoardsResponses end def serialize_as_json(resource) - resource.as_json(only: [:id]) + serializer.represent(resource).as_json end def respond_with(resource) @@ -80,4 +80,8 @@ module BoardsResponses end end end + + def serializer + BoardSerializer.new + end end |