Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

Commit

Permalink
Add user handle to notification mail recipient address (mastodon#24240)
Browse files Browse the repository at this point in the history
Co-authored-by: luccamps <luccamps@users.noreply.github.com>
Co-authored-by: Leonardo Negreiros de Oliveira <negreirosleo12@gmail.com>
Co-authored-by: Marcio Flavio <mflaviof1995@gmail.com>
Co-authored-by: Gabriel Quaresma <j.quaresmasantos_98@hotmail.com>
  • Loading branch information
5 people authored Apr 17, 2023
1 parent bc4745f commit 4601e0d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions app/mailers/notification_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def mention(recipient, notification)

locale_for_account(@me) do
thread_by_conversation(@status.conversation)
mail to: @me.user.email, subject: I18n.t('notification_mailer.mention.subject', name: @status.account.acct)
mail to: email_address_with_name(@me.user.email, @me.user.account.username), subject: I18n.t('notification_mailer.mention.subject', name: @status.account.acct)
end
end

Expand All @@ -25,7 +25,7 @@ def follow(recipient, notification)
return unless @me.user.functional?

locale_for_account(@me) do
mail to: @me.user.email, subject: I18n.t('notification_mailer.follow.subject', name: @account.acct)
mail to: email_address_with_name(@me.user.email, @me.user.account.username), subject: I18n.t('notification_mailer.follow.subject', name: @account.acct)
end
end

Expand All @@ -38,7 +38,7 @@ def favourite(recipient, notification)

locale_for_account(@me) do
thread_by_conversation(@status.conversation)
mail to: @me.user.email, subject: I18n.t('notification_mailer.favourite.subject', name: @account.acct)
mail to: email_address_with_name(@me.user.email, @me.user.account.username), subject: I18n.t('notification_mailer.favourite.subject', name: @account.acct)
end
end

Expand All @@ -51,7 +51,7 @@ def reblog(recipient, notification)

locale_for_account(@me) do
thread_by_conversation(@status.conversation)
mail to: @me.user.email, subject: I18n.t('notification_mailer.reblog.subject', name: @account.acct)
mail to: email_address_with_name(@me.user.email, @me.user.account.username), subject: I18n.t('notification_mailer.reblog.subject', name: @account.acct)
end
end

Expand All @@ -62,7 +62,7 @@ def follow_request(recipient, notification)
return unless @me.user.functional?

locale_for_account(@me) do
mail to: @me.user.email, subject: I18n.t('notification_mailer.follow_request.subject', name: @account.acct)
mail to: email_address_with_name(@me.user.email, @me.user.account.username), subject: I18n.t('notification_mailer.follow_request.subject', name: @account.acct)
end
end

Expand Down
10 changes: 5 additions & 5 deletions spec/mailers/notification_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

it 'renders the headers' do
expect(mail.subject).to eq('You were mentioned by bob')
expect(mail.to).to eq([receiver.email])
expect(mail[:to].value).to eq("#{receiver.account.username} <#{receiver.email}>")
end

it 'renders the body' do
Expand All @@ -46,7 +46,7 @@

it 'renders the headers' do
expect(mail.subject).to eq('bob is now following you')
expect(mail.to).to eq([receiver.email])
expect(mail[:to].value).to eq("#{receiver.account.username} <#{receiver.email}>")
end

it 'renders the body' do
Expand All @@ -62,7 +62,7 @@

it 'renders the headers' do
expect(mail.subject).to eq('bob favourited your post')
expect(mail.to).to eq([receiver.email])
expect(mail[:to].value).to eq("#{receiver.account.username} <#{receiver.email}>")
end

it 'renders the body' do
Expand All @@ -79,7 +79,7 @@

it 'renders the headers' do
expect(mail.subject).to eq('bob boosted your post')
expect(mail.to).to eq([receiver.email])
expect(mail[:to].value).to eq("#{receiver.account.username} <#{receiver.email}>")
end

it 'renders the body' do
Expand All @@ -96,7 +96,7 @@

it 'renders the headers' do
expect(mail.subject).to eq('Pending follower: bob')
expect(mail.to).to eq([receiver.email])
expect(mail[:to].value).to eq("#{receiver.account.username} <#{receiver.email}>")
end

it 'renders the body' do
Expand Down

0 comments on commit 4601e0d

Please sign in to comment.