mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-26 16:01:37 +01:00
Remove unused remote unfollow controller (#11250)
This commit is contained in:
parent
63c7fe8e48
commit
ef15246397
8 changed files with 0 additions and 113 deletions
|
@ -1,39 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class RemoteUnfollowsController < ApplicationController
|
||||
layout 'modal'
|
||||
|
||||
before_action :authenticate_user!
|
||||
before_action :set_body_classes
|
||||
|
||||
def create
|
||||
@account = unfollow_attempt.try(:target_account)
|
||||
|
||||
if @account.nil?
|
||||
render :error
|
||||
else
|
||||
render :success
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound, Mastodon::NotPermittedError
|
||||
render :error
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def unfollow_attempt
|
||||
username, domain = acct_without_prefix.split('@')
|
||||
UnfollowService.new.call(current_account, Account.find_remote!(username, domain))
|
||||
end
|
||||
|
||||
def acct_without_prefix
|
||||
acct_params.gsub(/\Aacct:/, '')
|
||||
end
|
||||
|
||||
def acct_params
|
||||
params.fetch(:acct, '')
|
||||
end
|
||||
|
||||
def set_body_classes
|
||||
@body_classes = 'modal-layout'
|
||||
end
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
.account-card
|
||||
.detailed-status__display-name
|
||||
%div
|
||||
= image_tag account.avatar.url(:original), alt: '', width: 48, height: 48, class: 'avatar'
|
||||
|
||||
%span.display-name
|
||||
- account_url = local_assigns[:admin] ? admin_account_path(account.id) : ActivityPub::TagManager.instance.url_for(account)
|
||||
= link_to account_url, class: 'detailed-status__display-name p-author h-card', target: '_blank', rel: 'noopener' do
|
||||
%strong.emojify= display_name(account, custom_emojify: true)
|
||||
%span @#{account.acct}
|
||||
|
||||
- if account.note?
|
||||
.account__header__content.emojify= Formatter.instance.simplified_format(account)
|
|
@ -1,4 +0,0 @@
|
|||
.post-follow-actions
|
||||
%div= link_to t('authorize_follow.post_follow.web'), web_url("accounts/#{@account.id}"), class: 'button button--block'
|
||||
%div= link_to t('authorize_follow.post_follow.return'), ActivityPub::TagManager.instance.url_for(@account), class: 'button button--block'
|
||||
%div= t('authorize_follow.post_follow.close')
|
|
@ -1,3 +0,0 @@
|
|||
.form-container
|
||||
.flash-message#error_explanation
|
||||
= t('remote_unfollow.error')
|
|
@ -1,10 +0,0 @@
|
|||
- content_for :page_title do
|
||||
= t('remote_unfollow.title', acct: @account.acct)
|
||||
|
||||
.form-container
|
||||
.follow-prompt
|
||||
%h2= t('remote_unfollow.unfollowed')
|
||||
|
||||
= render 'application/card', account: @account
|
||||
|
||||
= render 'post_follow_actions'
|
|
@ -810,10 +810,6 @@ en:
|
|||
reply:
|
||||
proceed: Proceed to reply
|
||||
prompt: 'You want to reply to this toot:'
|
||||
remote_unfollow:
|
||||
error: Error
|
||||
title: Title
|
||||
unfollowed: Unfollowed
|
||||
scheduled_statuses:
|
||||
over_daily_limit: You have exceeded the limit of %{limit} scheduled toots for that day
|
||||
over_total_limit: You have exceeded the limit of %{limit} scheduled toots
|
||||
|
|
|
@ -141,8 +141,6 @@ Rails.application.routes.draw do
|
|||
get '/public', to: 'public_timelines#show', as: :public_timeline
|
||||
get '/media_proxy/:id/(*any)', to: 'media_proxy#show', as: :media_proxy
|
||||
|
||||
# Remote follow
|
||||
resource :remote_unfollow, only: [:create]
|
||||
resource :authorize_interaction, only: [:show, :create]
|
||||
resource :share, only: [:show, :create]
|
||||
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe RemoteUnfollowsController do
|
||||
render_views
|
||||
|
||||
describe '#create' do
|
||||
subject { post :create, params: { acct: acct } }
|
||||
|
||||
let(:current_user) { Fabricate(:user, account: current_account) }
|
||||
let(:current_account) { Fabricate(:account) }
|
||||
let(:remote_account) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox')).account }
|
||||
before do
|
||||
sign_in current_user
|
||||
current_account.follow!(remote_account)
|
||||
stub_request(:post, 'http://example.com/inbox') { { status: 200 } }
|
||||
end
|
||||
|
||||
context 'when successfully unfollow remote account' do
|
||||
let(:acct) { "acct:#{remote_account.username}@#{remote_account.domain}" }
|
||||
|
||||
it do
|
||||
is_expected.to render_template :success
|
||||
expect(current_account.following?(remote_account)).to be false
|
||||
end
|
||||
end
|
||||
|
||||
context 'when fails to unfollow remote account' do
|
||||
let(:acct) { "acct:#{remote_account.username + '_test'}@#{remote_account.domain}" }
|
||||
|
||||
it do
|
||||
is_expected.to render_template :error
|
||||
expect(current_account.following?(remote_account)).to be true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue