Skip to content

Commit

Permalink
Revert for deploy (#4440)
Browse files Browse the repository at this point in the history
* Revert "Re-opt in opt-outs if they email us on demo (#4438)"

This reverts commit f88f442.

* Revert "Re-opt in opt-outs if they email us (#4362)"

This reverts commit 11b7226.
  • Loading branch information
tofarr authored Apr 4, 2024
1 parent a65f66a commit 95b9add
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 55 deletions.
10 changes: 0 additions & 10 deletions app/models/incoming_email.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class IncomingEmail < ApplicationRecord
has_many :documents, as: :contact_record

after_create { InteractionTrackingService.record_incoming_interaction(client) }
after_create { enable_email_opt_in }

def body
stripped_text.present? ? [stripped_text, stripped_signature].map(&:presence).compact.join("\n") : body_plain
Expand All @@ -43,13 +42,4 @@ def body
def datetime
received_at
end

def enable_email_opt_in
if Rails.env == 'demo' && (to == 'hello@mg-demo.getyourrefund-testing.org' || to == 'support@mg-demo.getyourrefund-testing.org')
self.client.intake.update(email_notification_opt_in: "yes")
end
if to == 'hello@getyourrefund.org' || to == 'support@getyourrefund.org'
self.client.intake.update(email_notification_opt_in: "yes")
end
end
end
45 changes: 0 additions & 45 deletions spec/models/incoming_email_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,49 +75,4 @@
let(:subject) { build(:incoming_email) }
end
end

context 'enable_email_opt_in' do
let(:intake) { create :intake, email_notification_opt_in: 'no' }
let(:client) { intake.client }
let(:subject) {
build(
:incoming_email,
stripped_text: nil,
stripped_signature: nil,
body_plain: "I love sending emails to websites",
client_id: client.id,
to: 'hello@getyourrefund.org',
)
}

it 'updates email_notification_opt_in to yes with correct incoming_email' do
expect(intake.email_notification_opt_in).to eq('no')
subject.save
expect(intake.reload.email_notification_opt_in).to eq('yes')
end
end

context 'enable_email_opt_in on demo' do
let(:intake) { create :intake, email_notification_opt_in: 'no' }
let(:client) { intake.client }
let(:subject) {
build(
:incoming_email,
stripped_text: nil,
stripped_signature: nil,
body_plain: "I love sending emails to websites",
client_id: client.id,
to: 'hello@mg-demo.getyourrefund-testing.org',
)
}
before do
allow(Rails).to receive(:env).and_return('demo')
end

it 'updates email_notification_opt_in to yes with correct incoming_email' do
expect(intake.email_notification_opt_in).to eq('no')
subject.save
expect(intake.reload.email_notification_opt_in).to eq('yes')
end
end
end

0 comments on commit 95b9add

Please sign in to comment.