From 2764338453759adacfc648a2940ce638d874d5cf Mon Sep 17 00:00:00 2001 From: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com> Date: Tue, 23 May 2023 09:37:40 +0530 Subject: [PATCH] fix: Fixes wrong copy being sent to users via email invite [cw-1290] (#7159) * fix: Fixes invite email copy * fix: Fixes wrong copy being sent to users via email invite --- app/views/devise/mailer/confirmation_instructions.html.erb | 4 +++- spec/mailers/confirmation_instructions_spec.rb | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb index ef94788a2..4a3b450a3 100644 --- a/app/views/devise/mailer/confirmation_instructions.html.erb +++ b/app/views/devise/mailer/confirmation_instructions.html.erb @@ -9,9 +9,11 @@ <% if @resource.confirmed? %>
You can login to your <%= global_config['BRAND_NAME'] || 'Chatwoot' %> account through the link below:
<% else %> + <% if account_user&.inviter.blank? %>Welcome to <%= global_config['BRAND_NAME'] || 'Chatwoot' %>! We have a suite of powerful tools ready for you to explore. Before that we quickly need to verify your email address to know it's really you.
+ <% end %>Please take a moment and click the link below and activate your account.
<% end %> @@ -24,4 +26,4 @@<%= link_to 'Confirm my account', frontend_url('auth/password/edit', reset_password_token: @resource.send(:set_reset_password_token)) %>
<% else %><%= link_to 'Confirm my account', frontend_url('auth/confirmation', confirmation_token: @token) %>
-<% end %> +<% end %> \ No newline at end of file diff --git a/spec/mailers/confirmation_instructions_spec.rb b/spec/mailers/confirmation_instructions_spec.rb index 8c66c4fea..7c6fd8e6c 100644 --- a/spec/mailers/confirmation_instructions_spec.rb +++ b/spec/mailers/confirmation_instructions_spec.rb @@ -27,6 +27,7 @@ RSpec.describe 'Confirmation Instructions' do it 'does not refer to the inviter and their account' do expect(mail.body).to_not match('has invited you to try out Chatwoot!') + expect(mail.body).to match('We have a suite of powerful tools ready for you to explore.') end it 'sends a confirmation link' do @@ -41,6 +42,7 @@ RSpec.describe 'Confirmation Instructions' do expect(mail.body).to match( "#{CGI.escapeHTML(inviter_val.name)}, with #{CGI.escapeHTML(account.name)}, has invited you to try out Chatwoot." ) + expect(mail.body).not_to match('We have a suite of powerful tools ready for you to explore.') end it 'sends a password reset link' do