diff options
author | Shuhei Kitagawa <shuheiktgw@users.noreply.github.com> | 2018-06-24 19:55:55 +0900 |
---|---|---|
committer | Yamagishi Kazutoshi <ykzts@desire.sh> | 2018-06-24 19:55:55 +0900 |
commit | 23955d956e799538b3e05fcd967390a541cfe473 (patch) | |
tree | 56c2d35658548ddd1303ed029c4c9c1a3cabf5b1 /app/controllers/remote_unfollows.rb | |
parent | 245fa1446aec609271e8d51d871ff9474e7298ae (diff) |
Add tests for remote_unfollows_controller (#7879)
Diffstat (limited to 'app/controllers/remote_unfollows.rb')
-rw-r--r-- | app/controllers/remote_unfollows.rb | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/app/controllers/remote_unfollows.rb b/app/controllers/remote_unfollows.rb deleted file mode 100644 index af5943363..000000000 --- a/app/controllers/remote_unfollows.rb +++ /dev/null @@ -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 |