Adds new follower/following routes (#24601)

This commit is contained in:
João Pedro Marques 2023-04-30 04:01:42 -03:00 committed by GitHub
parent 0669822ae8
commit 8f6e290c7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 0 deletions

View file

@ -83,6 +83,8 @@ Rails.application.routes.draw do
} }
get '/users/:username', to: redirect('/@%{username}'), constraints: lambda { |req| req.format.nil? || req.format.html? } get '/users/:username', to: redirect('/@%{username}'), constraints: lambda { |req| req.format.nil? || req.format.html? }
get '/users/:username/following', to: redirect('/@%{username}/following'), constraints: lambda { |req| req.format.nil? || req.format.html? }
get '/users/:username/followers', to: redirect('/@%{username}/followers'), constraints: lambda { |req| req.format.nil? || req.format.html? }
get '/users/:username/statuses/:id', to: redirect('/@%{username}/%{id}'), constraints: lambda { |req| req.format.nil? || req.format.html? } get '/users/:username/statuses/:id', to: redirect('/@%{username}/%{id}'), constraints: lambda { |req| req.format.nil? || req.format.html? }
get '/authorize_follow', to: redirect { |_, request| "/authorize_interaction?#{request.params.to_query}" } get '/authorize_follow', to: redirect { |_, request| "/authorize_interaction?#{request.params.to_query}" }

View file

@ -0,0 +1,13 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'FollowerAccountsController' do
describe 'The follower_accounts route' do
it "returns a http 'moved_permanently' code" do
get '/users/:username/followers'
expect(response).to have_http_status(301)
end
end
end

View file

@ -0,0 +1,13 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'FollowingAccountsController' do
describe 'The following_accounts route' do
it "returns a http 'moved_permanently' code" do
get '/users/:username/following'
expect(response).to have_http_status(301)
end
end
end