Disallow adding blocked users to lists

This commit is contained in:
Karina Kwiatek 2022-06-09 19:55:56 +02:00 committed by Karina Kwiatek
parent b38ae50ba7
commit 56799f60c7
2 changed files with 9 additions and 0 deletions

View File

@ -95,6 +95,9 @@ class Ajax::ListController < AjaxController
target_user = User.find_by_screen_name!(params[:user])
raise Errors::ListingSelfBlockedOther if current_user.blocking?(target_user)
raise Errors::ListingOtherBlockedSelf if target_user.blocking?(current_user)
if add
list.add_member target_user if list.members.find_by_user_id(target_user.id).nil?
@response[:checked] = true

View File

@ -85,5 +85,11 @@ module Errors
class ReactingOtherBlockedSelf < OtherBlockedSelf
end
class ListingSelfBlockedOther < SelfBlockedOther
end
class ListingOtherBlockedSelf < OtherBlockedSelf
end
# endregion
end