mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 21:52:43 +08:00
FEATURE: automatic PM when a user's email is revoked
This commit is contained in:
@ -2593,6 +2593,15 @@ en:
|
|||||||
Please make sure you have properly configured the POP credentials in [the site settings](%{base_url}/admin/site_settings/category/email).
|
Please make sure you have properly configured the POP credentials in [the site settings](%{base_url}/admin/site_settings/category/email).
|
||||||
|
|
||||||
If there is a web UI for the POP email account, you may need to log in on the web and check your settings there.
|
If there is a web UI for the POP email account, you may need to log in on the web and check your settings there.
|
||||||
|
|
||||||
|
email_revoked:
|
||||||
|
title: "Email Revoked"
|
||||||
|
subject_template: "[%{email_prefix}] Is your email address correct?"
|
||||||
|
text_body_template: |
|
||||||
|
We're sorry, but we're having trouble reaching you via email.
|
||||||
|
|
||||||
|
Can you make sure [your email address](%{base_url}/my/preferences/email) is a valid and working email address?
|
||||||
|
|
||||||
too_many_spam_flags:
|
too_many_spam_flags:
|
||||||
title: "Too Many Spam Flags"
|
title: "Too Many Spam Flags"
|
||||||
subject_template: "New account on hold"
|
subject_template: "New account on hold"
|
||||||
|
@ -232,9 +232,12 @@ module Email
|
|||||||
reason = I18n.t("user.deactivated", email: user.email)
|
reason = I18n.t("user.deactivated", email: user.email)
|
||||||
StaffActionLogger.new(Discourse.system_user).log_user_deactivate(user, reason)
|
StaffActionLogger.new(Discourse.system_user).log_user_deactivate(user, reason)
|
||||||
elsif range === SiteSetting.bounce_score_threshold
|
elsif range === SiteSetting.bounce_score_threshold
|
||||||
# NOTE: we check bounce_score before sending emails, nothing to do here other than log it happened.
|
# NOTE: we check bounce_score before sending emails
|
||||||
|
# So log we revoked the email...
|
||||||
reason = I18n.t("user.email.revoked", email: user.email, date: user.user_stat.reset_bounce_score_after)
|
reason = I18n.t("user.email.revoked", email: user.email, date: user.user_stat.reset_bounce_score_after)
|
||||||
StaffActionLogger.new(Discourse.system_user).log_revoke_email(user, reason)
|
StaffActionLogger.new(Discourse.system_user).log_revoke_email(user, reason)
|
||||||
|
# ... and PM the user
|
||||||
|
SystemMessage.create_from_system_user(user, :email_revoked)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -129,6 +129,17 @@ describe Email::Receiver do
|
|||||||
expect(email_log_2.bounced).to eq(true)
|
expect(email_log_2.bounced).to eq(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "sends a system message once they reach the 'bounce_score_threshold'" do
|
||||||
|
expect(user.active).to eq(true)
|
||||||
|
|
||||||
|
user.user_stat.bounce_score = SiteSetting.bounce_score_threshold - 1
|
||||||
|
user.user_stat.save!
|
||||||
|
|
||||||
|
SystemMessage.expects(:create_from_system_user).with(user, :email_revoked)
|
||||||
|
|
||||||
|
expect { process(:hard_bounce_via_verp) }.to raise_error(Email::Receiver::BouncedEmailError)
|
||||||
|
end
|
||||||
|
|
||||||
it "automatically deactive users once they reach the 'bounce_score_threshold_deactivate' threshold" do
|
it "automatically deactive users once they reach the 'bounce_score_threshold_deactivate' threshold" do
|
||||||
expect(user.active).to eq(true)
|
expect(user.active).to eq(true)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user