Move V2 Filter methods under /api/v2 prefix (#20622)

* Move V2 Filter methods under /api/v2 prefix

* move over the tests too
shrike
trwnh 2022-11-14 01:34:07 -06:00 committed by GitHub
parent 457c37e47a
commit b59ce0a60f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 15 deletions

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class Api::V1::Filters::KeywordsController < Api::BaseController
class Api::V2::Filters::KeywordsController < Api::BaseController
before_action -> { doorkeeper_authorize! :read, :'read:filters' }, only: [:index, :show]
before_action -> { doorkeeper_authorize! :write, :'write:filters' }, except: [:index, :show]
before_action :require_user!

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class Api::V1::Filters::StatusesController < Api::BaseController
class Api::V2::Filters::StatusesController < Api::BaseController
before_action -> { doorkeeper_authorize! :read, :'read:filters' }, only: [:index, :show]
before_action -> { doorkeeper_authorize! :write, :'write:filters' }, except: [:index, :show]
before_action :require_user!

View File

@ -43,7 +43,7 @@ export const fetchFilters = () => (dispatch, getState) => {
export const createFilterStatus = (params, onSuccess, onFail) => (dispatch, getState) => {
dispatch(createFilterStatusRequest());
api(getState).post(`/api/v1/filters/${params.filter_id}/statuses`, params).then(response => {
api(getState).post(`/api/v2/filters/${params.filter_id}/statuses`, params).then(response => {
dispatch(createFilterStatusSuccess(response.data));
if (onSuccess) onSuccess();
}).catch(error => {

View File

@ -493,18 +493,10 @@ Rails.application.routes.draw do
resources :bookmarks, only: [:index]
resources :reports, only: [:create]
resources :trends, only: [:index], controller: 'trends/tags'
resources :filters, only: [:index, :create, :show, :update, :destroy] do
resources :keywords, only: [:index, :create], controller: 'filters/keywords'
resources :statuses, only: [:index, :create], controller: 'filters/statuses'
end
resources :filters, only: [:index, :create, :show, :update, :destroy]
resources :endorsements, only: [:index]
resources :markers, only: [:index, :create]
namespace :filters do
resources :keywords, only: [:show, :update, :destroy]
resources :statuses, only: [:show, :destroy]
end
namespace :apps do
get :verify_credentials, to: 'credentials#show'
end
@ -660,8 +652,16 @@ Rails.application.routes.draw do
resources :media, only: [:create]
resources :suggestions, only: [:index]
resources :filters, only: [:index, :create, :show, :update, :destroy]
resource :instance, only: [:show]
resources :filters, only: [:index, :create, :show, :update, :destroy] do
resources :keywords, only: [:index, :create], controller: 'filters/keywords'
resources :statuses, only: [:index, :create], controller: 'filters/statuses'
end
namespace :filters do
resources :keywords, only: [:show, :update, :destroy]
resources :statuses, only: [:show, :destroy]
end
namespace :admin do
resources :accounts, only: [:index]

View File

@ -1,6 +1,6 @@
require 'rails_helper'
RSpec.describe Api::V1::Filters::KeywordsController, type: :controller do
RSpec.describe Api::V2::Filters::KeywordsController, type: :controller do
render_views
let(:user) { Fabricate(:user) }

View File

@ -1,6 +1,6 @@
require 'rails_helper'
RSpec.describe Api::V1::Filters::StatusesController, type: :controller do
RSpec.describe Api::V2::Filters::StatusesController, type: :controller do
render_views
let(:user) { Fabricate(:user) }