mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Perform the where(...).first to find_by(...) refactoring.
This refactoring was automated using the command: bundle exec "ruby refactorings/where_dot_first_to_find_by/app.rb"
This commit is contained in:
@@ -137,7 +137,7 @@ class PostAlerter
|
||||
# Returns a list of users who were quoted in the post
|
||||
def extract_quoted_users(post)
|
||||
post.raw.scan(/\[quote=\"([^,]+),.+\"\]/).uniq.map do |m|
|
||||
User.where("username_lower = :username and id != :id", username: m.first.strip.downcase, id: post.user_id).first
|
||||
User.find_by("username_lower = :username and id != :id", username: m.first.strip.downcase, id: post.user_id)
|
||||
end.compact
|
||||
end
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class UserDestroyer
|
||||
categories.each do |c|
|
||||
c.user_id = Discourse.system_user.id
|
||||
c.save!
|
||||
if topic = Topic.with_deleted.where(id: c.topic_id).first
|
||||
if topic = Topic.with_deleted.find_by(id: c.topic_id)
|
||||
topic.try(:recover!)
|
||||
topic.user_id = Discourse.system_user.id
|
||||
topic.save!
|
||||
|
||||
Reference in New Issue
Block a user