2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-05 08:59:27 +08:00

removes whitespaces and uses scope

This commit is contained in:
Gerhard Schlager 2017-11-13 15:20:36 +01:00
parent 7370adeae3
commit d3baae5365
3 changed files with 15 additions and 13 deletions

View file

@ -446,8 +446,8 @@ module Email
incoming_emails = IncomingEmail
.joins(:post)
.where('posts.topic_id = ?', email_log.topic_id)
.where('incoming_emails.to_addresses ILIKE :email OR incoming_emails.cc_addresses ILIKE :email', email: "%#{email_log.reply_key}%")
.where('incoming_emails.to_addresses ILIKE :email OR incoming_emails.cc_addresses ILIKE :email', email: "%#{user.email}%")
.addressed_to(email_log.reply_key)
.addressed_to(user.email)
incoming_emails.each do |email|
next unless contains_email_address?(email.to_addresses, user.email) ||