Skip to content

Commit

Permalink
Merge PR #240 from TreinaDev/refactor/views-mailers-existentes
Browse files Browse the repository at this point in the history
[Refactor] Mensagem dos e-mails enviados pelo Portfoliorrr
  • Loading branch information
eliseuramos93 authored Feb 15, 2024
2 parents d216962 + d2ccc5c commit 2e3f9ea
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 11 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
8 changes: 7 additions & 1 deletion app/views/connections_mailer/notify_follow.html.erb
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
<p><%= @notification.notifiable.follower.full_name %> <%= t('notifications.started_following_you') %></p>
<p><%= t('.greeting', recipient: @notification.profile.full_name) %></p>

<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'), @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>
6 changes: 3 additions & 3 deletions app/views/likes_mailer/notify_like.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<dd><%= t('.comment_likes', like_count: @comment_likes.count) if @comment_likes.any? %></dd>
</dl>
<% if @post_likes.any? %>
<br><p><%= t('.most_liked_post') %> <%= link_to @most_liked_post.title, post_url(@most_liked_post) %></p>
<p><%= t('.most_liked_post') %> <%= link_to @most_liked_post.title, post_url(@most_liked_post) %></p>
<% end %>
<% if @comment_likes.any? %>
<p><%= t('.most_liked_comment', comment: @most_liked_comment.message) %> <%= link_to @most_liked_comment.post.title, post_url(@most_liked_comment.post) %></p>
<% end %>

<br><p><%= link_to t('click_btn'), profile_url(@user.profile) %> <%= t('.access_profile') %></p>
<p><%= link_to t('click_btn'), profile_url(@user.profile) %> <%= t('.access_profile') %></p>
<%= t('.regards') %>,
Portfoliorrr
<p>Portfoliorrr</p>
5 changes: 4 additions & 1 deletion config/locales/models/connections.pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@ pt-BR:

connections_mailer:
notify_follow:
subject: 'Alguém seguiu seu perfil'
subject: 'Alguém seguiu seu perfil'
greeting: Olá, %{recipient}!
access_profile: para acessar seu perfil e continuar interagindo.
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 2e3f9ea

Please sign in to comment.