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)
|
||||
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)
|
||||
rescue Reviewable::InvalidAction => e
|
||||
|
|
|
@ -357,6 +357,7 @@ describe ReviewablesController do
|
|||
it "succeeds for a valid action" do
|
||||
other_reviewable = Fabricate(:reviewable)
|
||||
|
||||
SiteSetting.must_approve_users = true
|
||||
put "/review/#{reviewable.id}/perform/approve_user.json?version=#{reviewable.version}"
|
||||
expect(response.code).to eq("200")
|
||||
json = response.parsed_body
|
||||
|
@ -369,6 +370,20 @@ describe ReviewablesController do
|
|||
|
||||
expect(reviewable.reload.version).to eq(1)
|
||||
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
|
||||
|
||||
context "claims" do
|
||||
|
|
Loading…
Reference in New Issue