mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
Move V2 Filter methods under /api/v2 prefix (#20622)
* Move V2 Filter methods under /api/v2 prefix * move over the tests too
This commit is contained in:
parent
457c37e47a
commit
b59ce0a60f
@ -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!
|
@ -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!
|
@ -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 => {
|
||||
|
@ -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]
|
||||
|
@ -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) }
|
@ -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) }
|
Loading…
Reference in New Issue
Block a user