From 4edeb7d9ebc76dce5d71f74ddec2c0ad2a88abd8 Mon Sep 17 00:00:00 2001 From: Rafael dos Santos Silva Date: Thu, 15 Dec 2022 22:08:05 -0300 Subject: [PATCH] DEV: Remove use of deprecated methods (#19486) --- app/models/user.rb | 2 +- spec/lib/stylesheet/manager_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 605638f390a..db81134eeaa 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -252,7 +252,7 @@ class User < ActiveRecord::Base end scope :filter_by_username_or_email, ->(filter) do - if filter =~ /.+@.+/ + if filter.is_a?(String) && filter =~ /.+@.+/ # probably an email so try the bypass if user_id = UserEmail.where("lower(email) = ?", filter.downcase).pluck_first(:user_id) return where('users.id = ?', user_id) diff --git a/spec/lib/stylesheet/manager_spec.rb b/spec/lib/stylesheet/manager_spec.rb index 9b4179bac3d..0218e675441 100644 --- a/spec/lib/stylesheet/manager_spec.rb +++ b/spec/lib/stylesheet/manager_spec.rb @@ -929,7 +929,7 @@ RSpec.describe Stylesheet::Manager do after do path = Stylesheet::Manager.send(:manifest_full_path) - File.delete(path) if File.exists?(path) + File.delete(path) if File.exist?(path) end it "returns a hash" do