DEV: Delete dead Topic#incoming_email_addresses code (#19970)

This code has been dead since b463a80cbfffa4aaa38e14cc674c4cd295468fd9,
we can delete it now.
This commit is contained in:
Martin Brennan
2023-01-25 09:34:41 +10:00
committed by GitHub
parent 3866867e45
commit 88a972c61b
3 changed files with 6 additions and 123 deletions

View File

@ -1892,46 +1892,6 @@ class Topic < ActiveRecord::Base
.first
end
def incoming_email_addresses(group: nil, received_before: Time.zone.now)
email_addresses = Set.new
# TODO(martin) Look at improving this N1, it will just get slower the
# more replies/incoming emails there are for the topic.
self
.incoming_email
.where("created_at <= ?", received_before)
.each do |incoming_email|
to_addresses = incoming_email.to_addresses_split
cc_addresses = incoming_email.cc_addresses_split
combined_addresses = [to_addresses, cc_addresses].flatten
# We only care about the emails addressed to the group or CC'd to the
# group if the group is present. If combined addresses is empty we do
# not need to do this check, and instead can proceed on to adding the
# from address.
#
# Will not include test1@gmail.com if the only IncomingEmail
# is:
#
# from: test1@gmail.com
# to: test+support@discoursemail.com
#
# Because we don't care about the from addresses and also the to address
# is not the email_username, which will be something like test1@gmail.com.
if group.present? && combined_addresses.any?
next if combined_addresses.none? { |address| address =~ group.email_username_regex }
end
email_addresses.add(incoming_email.from_address)
email_addresses.merge(combined_addresses)
end
email_addresses.subtract([nil, ""])
email_addresses.delete(group.email_username) if group.present?
email_addresses.to_a
end
def create_invite_notification!(target_user, notification_type, invited_by, post_number: 1)
if UserCommScreener.new(
acting_user: invited_by,