FIX: Correctly pass `invite_to_topic` param to invites (#18229)

Ensures the correct mailer template is used.
This commit is contained in:
Penar Musaraj 2022-09-12 19:16:53 +02:00 committed by GitHub
parent 3f2c3d5360
commit 08009cd4d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -140,6 +140,7 @@ class InvitesController < ApplicationController
topic_id: topic&.id,
group_ids: groups&.map(&:id),
expires_at: params[:expires_at],
invite_to_topic: params[:invite_to_topic]
)
if invite.present?

View File

@ -203,9 +203,9 @@ RSpec.describe InvitesController do
it 'works' do
sign_in(user)
post '/invites.json', params: { email: 'test@example.com', topic_id: topic.id }
post '/invites.json', params: { email: 'test@example.com', topic_id: topic.id, invite_to_topic: true }
expect(response.status).to eq(200)
expect(Jobs::InviteEmail.jobs.first['args'].first['invite_to_topic']).to be_falsey
expect(Jobs::InviteEmail.jobs.first['args'].first['invite_to_topic']).to be_truthy
end
it 'fails when topic_id is invalid' do