Move V2 Filter methods under /api/v2 prefix (#20622)
* Move V2 Filter methods under /api/v2 prefix * move over the tests tooremotes/1705712285054221092/tmp_refs/heads/main^2
parent
457c37e47a
commit
b59ce0a60f
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# 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! :read, :'read:filters' }, only: [:index, :show]
|
||||||
before_action -> { doorkeeper_authorize! :write, :'write:filters' }, except: [:index, :show]
|
before_action -> { doorkeeper_authorize! :write, :'write:filters' }, except: [:index, :show]
|
||||||
before_action :require_user!
|
before_action :require_user!
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# 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! :read, :'read:filters' }, only: [:index, :show]
|
||||||
before_action -> { doorkeeper_authorize! :write, :'write:filters' }, except: [:index, :show]
|
before_action -> { doorkeeper_authorize! :write, :'write:filters' }, except: [:index, :show]
|
||||||
before_action :require_user!
|
before_action :require_user!
|
|
@ -43,7 +43,7 @@ export const fetchFilters = () => (dispatch, getState) => {
|
||||||
export const createFilterStatus = (params, onSuccess, onFail) => (dispatch, getState) => {
|
export const createFilterStatus = (params, onSuccess, onFail) => (dispatch, getState) => {
|
||||||
dispatch(createFilterStatusRequest());
|
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));
|
dispatch(createFilterStatusSuccess(response.data));
|
||||||
if (onSuccess) onSuccess();
|
if (onSuccess) onSuccess();
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
|
|
@ -493,18 +493,10 @@ Rails.application.routes.draw do
|
||||||
resources :bookmarks, only: [:index]
|
resources :bookmarks, only: [:index]
|
||||||
resources :reports, only: [:create]
|
resources :reports, only: [:create]
|
||||||
resources :trends, only: [:index], controller: 'trends/tags'
|
resources :trends, only: [:index], controller: 'trends/tags'
|
||||||
resources :filters, only: [:index, :create, :show, :update, :destroy] do
|
resources :filters, only: [:index, :create, :show, :update, :destroy]
|
||||||
resources :keywords, only: [:index, :create], controller: 'filters/keywords'
|
|
||||||
resources :statuses, only: [:index, :create], controller: 'filters/statuses'
|
|
||||||
end
|
|
||||||
resources :endorsements, only: [:index]
|
resources :endorsements, only: [:index]
|
||||||
resources :markers, only: [:index, :create]
|
resources :markers, only: [:index, :create]
|
||||||
|
|
||||||
namespace :filters do
|
|
||||||
resources :keywords, only: [:show, :update, :destroy]
|
|
||||||
resources :statuses, only: [:show, :destroy]
|
|
||||||
end
|
|
||||||
|
|
||||||
namespace :apps do
|
namespace :apps do
|
||||||
get :verify_credentials, to: 'credentials#show'
|
get :verify_credentials, to: 'credentials#show'
|
||||||
end
|
end
|
||||||
|
@ -660,8 +652,16 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
resources :media, only: [:create]
|
resources :media, only: [:create]
|
||||||
resources :suggestions, only: [:index]
|
resources :suggestions, only: [:index]
|
||||||
resources :filters, only: [:index, :create, :show, :update, :destroy]
|
|
||||||
resource :instance, only: [:show]
|
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
|
namespace :admin do
|
||||||
resources :accounts, only: [:index]
|
resources :accounts, only: [:index]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe Api::V1::Filters::KeywordsController, type: :controller do
|
RSpec.describe Api::V2::Filters::KeywordsController, type: :controller do
|
||||||
render_views
|
render_views
|
||||||
|
|
||||||
let(:user) { Fabricate(:user) }
|
let(:user) { Fabricate(:user) }
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe Api::V1::Filters::StatusesController, type: :controller do
|
RSpec.describe Api::V2::Filters::StatusesController, type: :controller do
|
||||||
render_views
|
render_views
|
||||||
|
|
||||||
let(:user) { Fabricate(:user) }
|
let(:user) { Fabricate(:user) }
|
Loading…
Reference in New Issue