mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 13:51:09 +08:00
Prepare to drop EmailLog#topic_id
.
This commit is contained in:
@ -634,7 +634,7 @@ module Email
|
||||
def forwarded_reply_key?(email_log, user)
|
||||
incoming_emails = IncomingEmail
|
||||
.joins(:post)
|
||||
.where('posts.topic_id = ?', email_log.topic_id)
|
||||
.where('posts.topic_id = ?', email_log.topic.id)
|
||||
.addressed_to(email_log.reply_key)
|
||||
.addressed_to_user(user)
|
||||
.pluck(:to_addresses, :cc_addresses)
|
||||
|
@ -77,11 +77,9 @@ module Email
|
||||
# always set a default Message ID from the host
|
||||
@message.header['Message-ID'] = "<#{SecureRandom.uuid}@#{host}>"
|
||||
|
||||
if topic_id.present?
|
||||
email_log.topic_id = topic_id
|
||||
|
||||
post = Post.find_by(id: post_id)
|
||||
topic = Topic.find_by(id: topic_id)
|
||||
if topic_id.present? && post_id.present?
|
||||
post = Post.find_by(id: post_id, topic_id: topic_id)
|
||||
topic = post.topic
|
||||
first_post = topic.ordered_posts.first
|
||||
|
||||
topic_message_id = first_post.incoming_email&.message_id.present? ?
|
||||
|
Reference in New Issue
Block a user