Skip to content

Commit

Permalink
Refatora corpo do e-mail de InvitationMailer
Browse files Browse the repository at this point in the history
  • Loading branch information
eliseuramos93 committed Feb 15, 2024
1 parent f0fff71 commit d2ccc5c
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 9 deletions.
7 changes: 3 additions & 4 deletions app/mailers/invitations_mailer.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
class InvitationsMailer < ApplicationMailer
def received_invitation
profile = Profile.find(params[:profile_id])
project_title = params[:project_title]
mail(subject: t('.subject'), to: profile.user.email,
body: t('.body', title: project_title))
@profile = Profile.find(params[:profile_id])
@project_title = params[:project_title]
mail(subject: t('.subject'), to: @profile.user.email)
end
end
4 changes: 2 additions & 2 deletions app/views/connections_mailer/notify_follow.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

<p><%= link_to @notification.notifiable.follower.full_name, profile_url(@notification.notifiable.follower) %> <%= t('notifications.started_following_you') %></p>

<p><%= link_to t('click_btn'), profile_url(@notification.profile) %> <%= t('.access_profile') %></p>
<%= t('.regards') %>,
<p><%= link_to t('click_btn'), @notification.profile %> <%= t('.access_profile') %></p>
<%= t('.regards') %>
<p>Portfoliorrr</p>
7 changes: 7 additions & 0 deletions app/views/invitations_mailer/received_invitation.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<p><%= t('.greeting', recipient: @profile.full_name) %></p>

<p><%= t('.body', title: @project_title) %></p>

<p><%= link_to t('click_btn'), invitations_url %> <%= t('.access_invitations') %></p>
<%= t('.regards') %>
<p>Portfoliorrr</p>
2 changes: 1 addition & 1 deletion config/locales/models/connections.pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ pt-BR:
subject: 'Alguém seguiu seu perfil'
greeting: Olá, %{recipient}!
access_profile: para acessar seu perfil e continuar interagindo.
regards: Abraços
regards: Abraços,
5 changes: 4 additions & 1 deletion config/locales/models/invitation.pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@ pt-BR:

invitations_mailer:
received_invitation:
greeting: Olá, %{recipient}!
subject: 'Você recebeu um convite'
body: Você recebeu um convite para participar do projeto %{title}.
body: Você recebeu um convite para participar do projeto %{title}.
access_invitations: para ver seus convites e aceitá-los.
regards: Abraços,
3 changes: 2 additions & 1 deletion spec/mailer/connections_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
expect(mail.subject).to include 'Alguém seguiu seu perfil'
expect(mail.to).to eq [followed_profile.email]
expect(mail.from).to eq ['[email protected]']
expect(mail.body).to include 'Danilo Martins começou a seguir você'
expect(mail.body).to include "<a href=\"#{profile_url(follower.profile)}\">"
expect(mail.body).to include 'Danilo Martins</a> começou a seguir você'
end
end
end

0 comments on commit d2ccc5c

Please sign in to comment.