mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 07:53:49 +08:00
ignore some site settings for emails sent to mailinglist mirror category
This commit is contained in:
@ -105,7 +105,10 @@ module Email
|
||||
|
||||
if is_auto_generated?
|
||||
@incoming_email.update_columns(is_auto_generated: true)
|
||||
raise AutoGeneratedEmailError if SiteSetting.block_auto_generated_emails?
|
||||
|
||||
if SiteSetting.block_auto_generated_emails? && !sent_to_mailinglist_mirror?
|
||||
raise AutoGeneratedEmailError
|
||||
end
|
||||
end
|
||||
|
||||
if action = subscription_action_for(body, subject)
|
||||
@ -374,9 +377,20 @@ module Email
|
||||
end
|
||||
|
||||
def destinations
|
||||
all_destinations
|
||||
@destinations ||= all_destinations
|
||||
.map { |d| Email::Receiver.check_address(d) }
|
||||
.drop_while(&:blank?)
|
||||
.reject(&:blank?)
|
||||
end
|
||||
|
||||
def sent_to_mailinglist_mirror?
|
||||
destinations.each do |destination|
|
||||
next unless destination[:type] == :category
|
||||
|
||||
category = destination[:obj]
|
||||
return true if category.mailinglist_mirror?
|
||||
end
|
||||
|
||||
false
|
||||
end
|
||||
|
||||
def self.check_address(address)
|
||||
@ -573,7 +587,7 @@ module Email
|
||||
end
|
||||
|
||||
def find_related_post
|
||||
return if SiteSetting.find_related_post_with_key
|
||||
return if SiteSetting.find_related_post_with_key && !sent_to_mailinglist_mirror?
|
||||
|
||||
message_ids = [@mail.in_reply_to, Email::Receiver.extract_references(@mail.references)]
|
||||
message_ids.flatten!
|
||||
|
Reference in New Issue
Block a user