mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 20:22:45 +08:00
FIX: Approving a user was not sending an email (#11883)
When we made rejection emails optional we accidentally changed the default for approval emails from true to false.
This commit is contained in:
parent
d8846e4fcd
commit
a20bcd34da
|
@ -189,7 +189,7 @@ class ReviewablesController < ApplicationController
|
||||||
return render_json_error(error)
|
return render_json_error(error)
|
||||||
end
|
end
|
||||||
|
|
||||||
args.merge!(reject_reason: params[:reject_reason], send_email: params[:send_email] == "true") if reviewable.type == 'ReviewableUser'
|
args.merge!(reject_reason: params[:reject_reason], send_email: params[:send_email] != "false") if reviewable.type == 'ReviewableUser'
|
||||||
|
|
||||||
result = reviewable.perform(current_user, params[:action_id].to_sym, args)
|
result = reviewable.perform(current_user, params[:action_id].to_sym, args)
|
||||||
rescue Reviewable::InvalidAction => e
|
rescue Reviewable::InvalidAction => e
|
||||||
|
|
|
@ -357,6 +357,7 @@ describe ReviewablesController do
|
||||||
it "succeeds for a valid action" do
|
it "succeeds for a valid action" do
|
||||||
other_reviewable = Fabricate(:reviewable)
|
other_reviewable = Fabricate(:reviewable)
|
||||||
|
|
||||||
|
SiteSetting.must_approve_users = true
|
||||||
put "/review/#{reviewable.id}/perform/approve_user.json?version=#{reviewable.version}"
|
put "/review/#{reviewable.id}/perform/approve_user.json?version=#{reviewable.version}"
|
||||||
expect(response.code).to eq("200")
|
expect(response.code).to eq("200")
|
||||||
json = response.parsed_body
|
json = response.parsed_body
|
||||||
|
@ -369,6 +370,20 @@ describe ReviewablesController do
|
||||||
|
|
||||||
expect(reviewable.reload.version).to eq(1)
|
expect(reviewable.reload.version).to eq(1)
|
||||||
expect(other_reviewable.reload.version).to eq(0)
|
expect(other_reviewable.reload.version).to eq(0)
|
||||||
|
|
||||||
|
job = Jobs::CriticalUserEmail.jobs.first
|
||||||
|
expect(job).to be_present
|
||||||
|
expect(job['args'][0]['type']).to eq('signup_after_approval')
|
||||||
|
end
|
||||||
|
|
||||||
|
it "doesn't send email when `send_email` is false" do
|
||||||
|
other_reviewable = Fabricate(:reviewable)
|
||||||
|
|
||||||
|
SiteSetting.must_approve_users = true
|
||||||
|
put "/review/#{reviewable.id}/perform/approve_user.json?version=#{reviewable.version}&send_email=false"
|
||||||
|
|
||||||
|
job = Jobs::CriticalUserEmail.jobs.first
|
||||||
|
expect(job).to be_blank
|
||||||
end
|
end
|
||||||
|
|
||||||
context "claims" do
|
context "claims" do
|
||||||
|
|
Loading…
Reference in New Issue
Block a user