Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2016-10-13 17:21:14 +0300
committerSean McGivern <sean@mcgivern.me.uk>2016-10-13 17:21:14 +0300
commit11e93ad59d6209bf9805a6f7053719e8052cc508 (patch)
tree0770038bcfb327e45381e8f45ba6629c02a09f12 /lib
parent36dafbbb02201ad36ca7e59f699cbf727494129e (diff)
parent25c82c6faf067a82e99bad590357ad57618475d9 (diff)
Merge branch 'feature/issues-board' into 'master'
Refactoring Issues Board ## What does this MR do? This MR aims to minimize conflicts between the CE issues board feature with EE multiple boards feature. ## Are there points in the code the reviewer needs to double check? ## Why was this MR needed? To avoid a lot of conflicts with EE multiple boards feature. ## Screenshots (if relevant) ## Does this MR meet the acceptance criteria? - [ ] ~~[CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added~~ - [ ] ~~[Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~ - [x] API support added - Tests - [X] Added for this feature/bug - [ ] All builds are passing - [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html) - [X] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [ ] Branch has no merge conflicts with `master` (if you do - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) ## What are the relevant issue numbers? https://gitlab.com/gitlab-org/gitlab-ee/issues/929 https://gitlab.com/gitlab-org/gitlab-ee/issues/1084 See merge request !6727
Diffstat (limited to 'lib')
-rw-r--r--lib/api/boards.rb31
1 files changed, 17 insertions, 14 deletions
diff --git a/lib/api/boards.rb b/lib/api/boards.rb
index 4d5d144a02e..9b71d335128 100644
--- a/lib/api/boards.rb
+++ b/lib/api/boards.rb
@@ -7,13 +7,14 @@ module API
# Get the project board
get ':id/boards' do
authorize!(:read_board, user_project)
- present [user_project.board], with: Entities::Board
+ present user_project.boards, with: Entities::Board
end
segment ':id/boards/:board_id' do
helpers do
def project_board
- board = user_project.board
+ board = user_project.boards.first
+
if params[:board_id].to_i == board.id
board
else
@@ -55,8 +56,10 @@ module API
authorize!(:admin_list, user_project)
- list = ::Boards::Lists::CreateService.new(user_project, current_user,
- { label_id: params[:label_id] }).execute
+ service = ::Boards::Lists::CreateService.new(user_project, current_user,
+ { label_id: params[:label_id] })
+
+ list = service.execute(project_board)
if list.valid?
present list, with: Entities::List
@@ -78,10 +81,10 @@ module API
authorize!(:admin_list, user_project)
- moved = ::Boards::Lists::MoveService.new(user_project, current_user,
- { position: params[:position].to_i }).execute(list)
+ service = ::Boards::Lists::MoveService.new(user_project, current_user,
+ { position: params[:position].to_i })
- if moved
+ if service.execute(list)
present list, with: Entities::List
else
render_api_error!({ error: "List could not be moved!" }, 400)
@@ -97,16 +100,16 @@ module API
# Example Request:
# DELETE /projects/:id/boards/:board_id/lists/:list_id
delete "/lists/:list_id" do
- list = board_lists.find_by(id: params[:list_id])
-
authorize!(:admin_list, user_project)
- if list
- destroyed_list = ::Boards::Lists::DestroyService.new(
- user_project, current_user).execute(list)
- present destroyed_list, with: Entities::List
+ list = board_lists.find(params[:list_id])
+
+ service = ::Boards::Lists::DestroyService.new(user_project, current_user)
+
+ if service.execute(list)
+ present list, with: Entities::List
else
- not_found!('List')
+ render_api_error!({ error: 'List could not be deleted!' }, 400)
end
end
end