mirror of
https://github.com/discourse/discourse.git
synced 2026-08-13 06:25:11 -05:00
FEATURE: Add more columns to outbound EmailLog (#13449)
This adds the following columns to EmailLog: * cc_addresses * cc_user_ids * topic_id * raw This is to bring the EmailLog table closer in parity to IncomingEmail so it can be better utilized for Group SMTP and IMAP mailing. The raw column contains the full content of the outbound email, but _only_ if the new hidden site setting enable_raw_outbound_email_logging is enabled. Most sites do not need it, and it's mostly required for IMAP and SMTP sending. In the next pull request, there will be a migration to backfill topic_id on the EmailLog table, at which point we can remove the topic fallback method on EmailLog.
This commit is contained in:
@@ -110,4 +110,32 @@ describe EmailLog do
|
||||
expect(EmailLog.find(email_log.id).bounce_key).to eq(hex)
|
||||
end
|
||||
end
|
||||
|
||||
describe "cc addresses handling" do
|
||||
let!(:email_log) { Fabricate(:email_log, user: user) }
|
||||
|
||||
describe "#cc_addresses_split" do
|
||||
it "returns empty array if there are no cc addresses" do
|
||||
expect(email_log.cc_addresses_split).to eq([])
|
||||
end
|
||||
|
||||
it "returns array of cc addresses if there are any" do
|
||||
email_log.update(cc_addresses: "test@test.com;test@test2.com")
|
||||
expect(email_log.cc_addresses_split).to eq(["test@test.com", "test@test2.com"])
|
||||
end
|
||||
end
|
||||
|
||||
describe "#cc_users" do
|
||||
it "returns empty array if there are no cc users" do
|
||||
expect(email_log.cc_users).to eq([])
|
||||
end
|
||||
|
||||
it "returns array of users if cc_user_ids is present" do
|
||||
cc_user = Fabricate(:user, email: "test@test.com")
|
||||
cc_user2 = Fabricate(:user, email: "test@test2.com")
|
||||
email_log.update(cc_addresses: "test@test.com;test@test2.com", cc_user_ids: [cc_user.id, cc_user2.id])
|
||||
expect(email_log.cc_users).to match_array([cc_user, cc_user2])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user