Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/controllers/reviewer/proposals_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class Reviewer::ProposalsController < Reviewer::ApplicationController

decorates_assigned :proposal, with: Reviewer::ProposalDecorator


def index
proposal_ids = current_user.proposals.pluck(:id)

Expand Down
3 changes: 2 additions & 1 deletion app/mailers/comment_notification_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ def email_notification(comment)
end.compact

if bcc.any?
mail_markdown(bcc: bcc,
mail_markdown(
bcc: bcc,
from: @proposal.event.contact_email,
subject: "CFP #{@proposal.event.name}: A comment has been posted on '#{@proposal.title}'")
end
Expand Down
8 changes: 4 additions & 4 deletions app/mailers/organizer/proposal_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ def waitlist_email(event, proposal)
private

def mail_to_speakers(event, proposal, subject)
bcc = proposal.speakers.map(&:email)
if bcc.any?
bcc << event.contact_email
to = proposal.speakers.map(&:email)
if to.any?
mail_markdown(
from: event.contact_email,
bcc: bcc,
to: to,
bcc: event.contact_email,
subject: subject
)
end
Expand Down
10 changes: 5 additions & 5 deletions app/mailers/proposal_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ def comment_notification(proposal, comment)
@proposal = proposal
@comment = comment

bcc = @proposal.speakers.map do |speaker|
to = @proposal.speakers.map do |speaker|
speaker.email if speaker.person != @comment.person
end

if bcc.any?
mail_markdown(bcc: bcc,
from: @proposal.event.contact_email,
subject: "CFP #{@proposal.event.name}: You've received a comment on your proposal '#{@proposal.title}'")
if to.any?
mail_markdown(to: to,
from: @proposal.event.contact_email,
subject: "CFP #{@proposal.event.name}: You've received a comment on your proposal '#{@proposal.title}'")
end
end
end
2 changes: 1 addition & 1 deletion spec/controllers/comments_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
}.to change(ActionMailer::Base.deliveries, :count).by(1)

email = ActionMailer::Base.deliveries.last
expect(email.bcc).to match_array(speakers.map(&:email))
expect(email.to).to match_array(speakers.map(&:email))
end
end

Expand Down
6 changes: 3 additions & 3 deletions spec/features/organizer/proposals_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
end

it "sends an email notification to the speaker" do
expect(ActionMailer::Base.deliveries.last.bcc).to include(speaker_person.email)
expect(ActionMailer::Base.deliveries.last.to).to include(speaker_person.email)
end
end

Expand All @@ -117,7 +117,7 @@
end

it "sends an email notification to the speaker" do
expect(ActionMailer::Base.deliveries.last.bcc).to include(speaker_person.email)
expect(ActionMailer::Base.deliveries.last.to).to include(speaker_person.email)
end
end

Expand All @@ -133,7 +133,7 @@
end

it "sends an email notification to the speaker" do
expect(ActionMailer::Base.deliveries.last.bcc).to include(speaker_person.email)
expect(ActionMailer::Base.deliveries.last.to).to include(speaker_person.email)
end
end

Expand Down
14 changes: 7 additions & 7 deletions spec/mailers/organizer/proposal_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
describe "accept_email" do
let(:mail) { Organizer::ProposalMailer.accept_email(event, proposal) }

it "bccs to all speakers including contact_mail" do
it "emails to all speakers including contact_mail" do
proposal.speakers = build_list(:speaker, 3)
proposal.save!
expect(mail.bcc.count).to eq(4)
bcc_emails = proposal.speakers.map(&:email) << event.contact_email
expect(mail.to.count).to eq(3)
bcc_emails = event.contact_email
expect(mail.bcc).to match_array(bcc_emails)
end

Expand Down Expand Up @@ -44,8 +44,8 @@
it "bccs to all speakers including contact_mail" do
proposal.speakers = build_list(:speaker, 3)
proposal.save!
expect(mail.bcc.count).to eq(4)
bcc_emails = proposal.speakers.map(&:email) << event.contact_email
expect(mail.to.count).to eq(3)
bcc_emails = event.contact_email
expect(mail.bcc).to match_array(bcc_emails)
end

Expand All @@ -68,8 +68,8 @@
it "bccs to all speakers including contact_mail" do
proposal.speakers = build_list(:speaker, 3)
proposal.save!
expect(mail.bcc.count).to eq(4)
bcc_emails = proposal.speakers.map(&:email) << event.contact_email
expect(mail.to.count).to eq(3)
bcc_emails = event.contact_email
expect(mail.bcc).to match_array(bcc_emails)
end

Expand Down
8 changes: 4 additions & 4 deletions spec/mailers/proposal_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
it "bccs to all speakers" do
proposal.speakers = build_list(:speaker, 3)
proposal.save!
expect(mail.bcc.count).to eq(3)
expect(mail.bcc).to match_array(proposal.speakers.map(&:email))
expect(mail.to.count).to eq(3)
expect(mail.to).to match_array(proposal.speakers.map(&:email))
end

it "doesn't bcc the speaker if they are also the commenter" do
proposal.speakers = build_list(:speaker, 3)
proposal.save!
proposal.speakers << build(:speaker, person: person)
expect(proposal.speakers.count).to eq(4)
expect(mail.bcc.count).to eq(3)
expect(mail.bcc).to match_array(proposal.speakers.first(3).map(&:email))
expect(mail.to.count).to eq(3)
expect(mail.to).to match_array(proposal.speakers.first(3).map(&:email))
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/models/public_comment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
proposal.public_comments.create(attributes_for(:comment, person: reviewer))
}.to change(ActionMailer::Base.deliveries, :count).by(1)

expect(ActionMailer::Base.deliveries.last.bcc).to match_array(speakers.map(&:email))
expect(ActionMailer::Base.deliveries.last.to).to match_array(speakers.map(&:email))
end
end
end
Expand Down