Fix namespace resolution in relationship use cases

This commit is contained in:
Karina Kwiatek 2022-01-15 11:08:58 +01:00 committed by Karina Kwiatek
parent ce57414595
commit c8059ccd6b
2 changed files with 6 additions and 6 deletions

View File

@ -37,15 +37,15 @@ module UseCase
def find_source_user def find_source_user
user_id = @current_user_id user_id = @current_user_id
User.find(user_id) ::User.find(user_id)
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
raise Errors::UserNotFound raise Errors::UserNotFound
end end
def find_target_user def find_target_user
target_user = @target_user target_user = @target_user
return target_user if target_user.is_a?(User) return target_user if target_user.is_a?(::User)
User.find_by!(screen_name: target_user) ::User.find_by!(screen_name: target_user)
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
raise Errors::UserNotFound raise Errors::UserNotFound
end end

View File

@ -37,15 +37,15 @@ module UseCase
def find_source_user def find_source_user
user_id = @current_user_id user_id = @current_user_id
User.find(user_id) ::User.find(user_id)
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
raise Errors::UserNotFound raise Errors::UserNotFound
end end
def find_target_user def find_target_user
target_user = @target_user target_user = @target_user
return target_user if target_user.is_a?(User) return target_user if target_user.is_a?(::User)
User.find_by!(screen_name: target_user) ::User.find_by!(screen_name: target_user)
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
raise Errors::UserNotFound raise Errors::UserNotFound
end end