From ab9d776b3baee29a883bc383585e2cf5b17e652a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gaya?= <sebastien.gaya@gmail.com> Date: Mon, 23 Oct 2023 11:03:01 +0200 Subject: [PATCH] moved website to api/osuny/communication/websites/app_ctrl --- app/controllers/api/osuny/application_controller.rb | 4 ---- .../communication/websites/application_controller.rb | 12 +++++------- .../osuny/communication/websites/pages_controller.rb | 2 +- .../osuny/communication/websites/posts_controller.rb | 2 +- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/app/controllers/api/osuny/application_controller.rb b/app/controllers/api/osuny/application_controller.rb index c19359153..5f3111aec 100644 --- a/app/controllers/api/osuny/application_controller.rb +++ b/app/controllers/api/osuny/application_controller.rb @@ -7,8 +7,4 @@ class Api::Osuny::ApplicationController < Api::ApplicationController raise_403_unless @app end - def website - @website ||= current_university.websites.find params[:website_id] - end - end \ No newline at end of file diff --git a/app/controllers/api/osuny/communication/websites/application_controller.rb b/app/controllers/api/osuny/communication/websites/application_controller.rb index 3df30d548..c90b53425 100644 --- a/app/controllers/api/osuny/communication/websites/application_controller.rb +++ b/app/controllers/api/osuny/communication/websites/application_controller.rb @@ -1,11 +1,9 @@ class Api::Osuny::Communication::Websites::ApplicationController < Api::Osuny::ApplicationController - skip_before_action :verify_authenticity_token, only: :import - before_action :verify_app_token, only: :import - def import - Importers::Api::Osuny::Communication::Website::Page.new university: current_university, - website: website, - params: params[:page] - render json: :ok + protected + + def website + @website ||= current_university.websites.find params[:website_id] end + end diff --git a/app/controllers/api/osuny/communication/websites/pages_controller.rb b/app/controllers/api/osuny/communication/websites/pages_controller.rb index f8ab5c320..ec16240c5 100644 --- a/app/controllers/api/osuny/communication/websites/pages_controller.rb +++ b/app/controllers/api/osuny/communication/websites/pages_controller.rb @@ -1,4 +1,4 @@ -class Api::Osuny::Communication::Websites::PagesController < Api::Osuny::ApplicationController +class Api::Osuny::Communication::Websites::PagesController < Api::Osuny::Communication::Websites::ApplicationController skip_before_action :verify_authenticity_token, only: :import before_action :verify_app_token, only: :import diff --git a/app/controllers/api/osuny/communication/websites/posts_controller.rb b/app/controllers/api/osuny/communication/websites/posts_controller.rb index cc0f67ea7..0b04dacf0 100644 --- a/app/controllers/api/osuny/communication/websites/posts_controller.rb +++ b/app/controllers/api/osuny/communication/websites/posts_controller.rb @@ -1,4 +1,4 @@ -class Api::Osuny::Communication::Websites::PostsController < Api::Osuny::ApplicationController +class Api::Osuny::Communication::Websites::PostsController < Api::Osuny::Communication::Websites::ApplicationController skip_before_action :verify_authenticity_token, only: :import before_action :verify_app_token, only: :import -- GitLab