Revert "FIX: Partial reply key search in email sent logs."

This reverts commit e9b2018bc8bc1254075bec597ce30a84f38b456e.
This commit is contained in:
Guo Xiang Tan
2019-01-10 09:56:03 +08:00
parent 798e98a7cc
commit d10694150e
7 changed files with 27 additions and 11 deletions

View File

@ -30,10 +30,16 @@ class Admin::EmailController < Admin::AdminController
email_logs = filter_logs(email_logs, params)
if params[:reply_key].present?
email_logs = email_logs.where(
"post_reply_keys.reply_key::TEXT ILIKE ?", "%#{params[:reply_key]}%"
)
if (reply_key = params[:reply_key]).present?
email_logs =
if reply_key.length == 32
email_logs.where("post_reply_keys.reply_key = ?", reply_key)
else
email_logs.where(
"replace(post_reply_keys.reply_key::VARCHAR, '-', '') ILIKE ?",
"%#{reply_key}%"
)
end
end
email_logs = email_logs.to_a