Add follow selected followers button (#15148)
* Add follow selected followers button * Fix unused variable * Fix i18n normalize
This commit is contained in:
parent
4790a126be
commit
2b1a6e734f
|
@ -49,7 +49,9 @@ class RelationshipsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def action_from_button
|
def action_from_button
|
||||||
if params[:unfollow]
|
if params[:follow]
|
||||||
|
'follow'
|
||||||
|
elsif params[:unfollow]
|
||||||
'unfollow'
|
'unfollow'
|
||||||
elsif params[:remove_from_followers]
|
elsif params[:remove_from_followers]
|
||||||
'remove_from_followers'
|
'remove_from_followers'
|
||||||
|
|
|
@ -9,6 +9,8 @@ class Form::AccountBatch
|
||||||
|
|
||||||
def save
|
def save
|
||||||
case action
|
case action
|
||||||
|
when 'follow'
|
||||||
|
follow!
|
||||||
when 'unfollow'
|
when 'unfollow'
|
||||||
unfollow!
|
unfollow!
|
||||||
when 'remove_from_followers'
|
when 'remove_from_followers'
|
||||||
|
@ -24,6 +26,12 @@ class Form::AccountBatch
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def follow!
|
||||||
|
accounts.find_each do |target_account|
|
||||||
|
FollowService.new.call(current_account, target_account)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def unfollow!
|
def unfollow!
|
||||||
accounts.find_each do |target_account|
|
accounts.find_each do |target_account|
|
||||||
UnfollowService.new.call(current_account, target_account)
|
UnfollowService.new.call(current_account, target_account)
|
||||||
|
|
|
@ -42,6 +42,8 @@
|
||||||
%label.batch-table__toolbar__select.batch-checkbox-all
|
%label.batch-table__toolbar__select.batch-checkbox-all
|
||||||
= check_box_tag :batch_checkbox_all, nil, false
|
= check_box_tag :batch_checkbox_all, nil, false
|
||||||
.batch-table__toolbar__actions
|
.batch-table__toolbar__actions
|
||||||
|
= f.button safe_join([fa_icon('user-plus'), t('relationships.follow_selected_followers')]), name: :follow, class: 'table-action-link', type: :submit, data: { confirm: t('admin.reports.are_you_sure') } if followed_by_relationship? && !mutual_relationship?
|
||||||
|
|
||||||
= f.button safe_join([fa_icon('user-times'), t('relationships.remove_selected_follows')]), name: :unfollow, class: 'table-action-link', type: :submit, data: { confirm: t('admin.reports.are_you_sure') } unless followed_by_relationship?
|
= f.button safe_join([fa_icon('user-times'), t('relationships.remove_selected_follows')]), name: :unfollow, class: 'table-action-link', type: :submit, data: { confirm: t('admin.reports.are_you_sure') } unless followed_by_relationship?
|
||||||
|
|
||||||
= f.button safe_join([fa_icon('trash'), t('relationships.remove_selected_followers')]), name: :remove_from_followers, class: 'table-action-link', type: :submit, data: { confirm: t('admin.reports.are_you_sure') } unless following_relationship?
|
= f.button safe_join([fa_icon('trash'), t('relationships.remove_selected_followers')]), name: :remove_from_followers, class: 'table-action-link', type: :submit, data: { confirm: t('admin.reports.are_you_sure') } unless following_relationship?
|
||||||
|
|
|
@ -1075,6 +1075,7 @@ en:
|
||||||
relationships:
|
relationships:
|
||||||
activity: Account activity
|
activity: Account activity
|
||||||
dormant: Dormant
|
dormant: Dormant
|
||||||
|
follow_selected_followers: Follow selected followers
|
||||||
followers: Followers
|
followers: Followers
|
||||||
following: Following
|
following: Following
|
||||||
invited: Invited
|
invited: Invited
|
||||||
|
|
Loading…
Reference in New Issue