summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-08-15 19:15:37 -0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-08-17 12:58:59 -0300
commitc3880d105744dde1c8a30978e0cf13ebe017a91b (patch)
tree89e13299a67cc9dd795d889d044be8d1a3ea4f53
parent57737785df21c160234487b25ee8b37289a91803 (diff)
downloadgitlab-ce-c3880d105744dde1c8a30978e0cf13ebe017a91b.tar.gz
Extract `Projects::Boards::ApplicationController`
-rw-r--r--app/controllers/projects/boards/application_controller.rb15
-rw-r--r--app/controllers/projects/boards/issues_controller.rb10
-rw-r--r--app/controllers/projects/boards/lists_controller.rb10
3 files changed, 17 insertions, 18 deletions
diff --git a/app/controllers/projects/boards/application_controller.rb b/app/controllers/projects/boards/application_controller.rb
new file mode 100644
index 00000000000..dad38fff6b9
--- /dev/null
+++ b/app/controllers/projects/boards/application_controller.rb
@@ -0,0 +1,15 @@
+module Projects
+ module Boards
+ class ApplicationController < Projects::ApplicationController
+ respond_to :json
+
+ rescue_from ActiveRecord::RecordNotFound, with: :record_not_found
+
+ private
+
+ def record_not_found(exception)
+ render json: { error: exception.message }, status: :not_found
+ end
+ end
+ end
+end
diff --git a/app/controllers/projects/boards/issues_controller.rb b/app/controllers/projects/boards/issues_controller.rb
index 1847c3f2c25..a038639d0ac 100644
--- a/app/controllers/projects/boards/issues_controller.rb
+++ b/app/controllers/projects/boards/issues_controller.rb
@@ -1,13 +1,9 @@
module Projects
module Boards
- class IssuesController < Projects::ApplicationController
- respond_to :json
-
+ class IssuesController < Boards::ApplicationController
before_action :authorize_read_issue!, only: [:index]
before_action :authorize_update_issue!, only: [:update]
- rescue_from ActiveRecord::RecordNotFound, with: :record_not_found
-
def index
issues = ::Boards::Issues::ListService.new(project, current_user, filter_params).execute
issues = issues.page(params[:page])
@@ -47,10 +43,6 @@ module Projects
def move_params
params.permit(:id, :from_list_id, :to_list_id)
end
-
- def record_not_found(exception)
- render json: { error: exception.message }, status: :not_found
- end
end
end
end
diff --git a/app/controllers/projects/boards/lists_controller.rb b/app/controllers/projects/boards/lists_controller.rb
index 255c0bf6e45..b426dc25e0d 100644
--- a/app/controllers/projects/boards/lists_controller.rb
+++ b/app/controllers/projects/boards/lists_controller.rb
@@ -1,12 +1,8 @@
module Projects
module Boards
- class ListsController < Projects::ApplicationController
- respond_to :json
-
+ class ListsController < Boards::ApplicationController
before_action :authorize_admin_list!
- rescue_from ActiveRecord::RecordNotFound, with: :record_not_found
-
def create
list = ::Boards::Lists::CreateService.new(project, current_user, list_params).execute
@@ -60,10 +56,6 @@ module Projects
def move_params
params.require(:list).permit(:position).merge(id: params[:id])
end
-
- def record_not_found(exception)
- render json: { error: exception.message }, status: :not_found
- end
end
end
end