mirror of https://github.com/mastodon/mastodon
Add page for authorizing/rejecting follow requests
parent
3c841c7306
commit
b302b9202b
@ -0,0 +1,28 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class FollowRequestsController < ApplicationController
|
||||||
|
layout 'auth'
|
||||||
|
|
||||||
|
before_action :authenticate_user!
|
||||||
|
before_action :set_follow_request, except: :index
|
||||||
|
|
||||||
|
def index
|
||||||
|
@follow_requests = FollowRequest.where(target_account: current_account)
|
||||||
|
end
|
||||||
|
|
||||||
|
def authorize
|
||||||
|
@follow_request.authorize!
|
||||||
|
redirect_to follow_requests_path
|
||||||
|
end
|
||||||
|
|
||||||
|
def reject
|
||||||
|
@follow_request.reject!
|
||||||
|
redirect_to follow_requests_path
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_follow_request
|
||||||
|
@follow_request = FollowRequest.find(params[:id])
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -0,0 +1,2 @@
|
|||||||
|
module FollowRequestsHelper
|
||||||
|
end
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
- content_for :page_title do
|
||||||
|
= t('follow_requests.title')
|
||||||
|
|
||||||
|
- if @follow_requests.empty?
|
||||||
|
%p.nothing-here= t('accounts.nothing_here')
|
||||||
|
- else
|
||||||
|
%table.table
|
||||||
|
%tbody
|
||||||
|
- @follow_requests.each do |follow_request|
|
||||||
|
%tr
|
||||||
|
%td= link_to follow_request.account.acct, web_path("accounts/#{follow_request.account.id}")
|
||||||
|
%td
|
||||||
|
= table_link_to 'check-circle', t('follow_requests.authorize'), authorize_follow_request_path(follow_request), method: :post
|
||||||
|
= table_link_to 'times-circle', t('follow_requests.reject'), reject_follow_request_path(follow_request), method: :post
|
||||||
|
|
||||||
|
.form-footer= render "settings/shared/links"
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe FollowRequestsController, type: :controller do
|
||||||
|
render_views
|
||||||
|
|
||||||
|
before do
|
||||||
|
sign_in Fabricate(:user), scope: :user
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'GET #index' do
|
||||||
|
it 'returns http success' do
|
||||||
|
get :index
|
||||||
|
expect(response).to have_http_status(:success)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe FollowRequestsHelper, type: :helper do
|
||||||
|
|
||||||
|
end
|
||||||
Loading…
Reference in New Issue