Skip to content
Open
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
2 changes: 1 addition & 1 deletion app/models/forem/subscription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Subscription < ActiveRecord::Base
def send_notification(post_id)
# If a user cannot be found, then no-op
# This will happen if the user record has been deleted.
if subscriber.present?
if subscriber.present? && subscriber.email
SubscriptionMailer.topic_reply(post_id, subscriber.id).deliver
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/models/subscription_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
end

# Regression test for #375
it "does not send a notification when user is missing" do
it "does not send a notification when user is missing or if there is no email address" do
subscription = Forem::Subscription.new
Forem::SubscriptionMailer.should_not_receive(:topic_reply)
subscription.send_notification(1)
Expand Down