Skip to content

Commit 680d168

Browse files
authored
Merge branch 'main' into dependabot/bundler/pg-1.6.1
2 parents 6fa8f0c + 5ca3c32 commit 680d168

File tree

9 files changed

+34
-29
lines changed

9 files changed

+34
-29
lines changed

app/mailers/better_together/conversation_mailer.rb

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,21 @@ def new_message_notification # rubocop:todo Metrics/MethodLength, Metrics/AbcSiz
1111
@recipient = params[:recipient]
1212
@sender = @message.sender
1313

14+
subject = t('better_together.conversation_mailer.new_message_notification.subject')
15+
if @conversation.title.present?
16+
subject = t('better_together.conversation_mailer.new_message_notification.subject_with_title',
17+
conversation: @conversation.title)
18+
end
19+
1420
# Override time zone and locale if necessary
1521
self.locale = @recipient.locale
1622
self.time_zone = @recipient.time_zone
1723

1824
mail(to: @recipient.email,
19-
subject: t('better_together.conversation_mailer.new_message_notification.subject',
20-
platform: @platform.name,
21-
conversation: @conversation.title))
25+
from: t('better_together.conversation_mailer.new_message_notification.from_address',
26+
sender_name: @sender.name,
27+
from_address: default_params[:from]),
28+
subject:)
2229
end
2330
# rubocop:enable Metrics/AbcSize
2431
end
Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
11
<!-- app/views/better_together/conversation_mailer/new_message_notification.html.erb -->
22

3-
<h2><%= t('.subject', platform: @platform.name, conversation: @conversation.title) %></h2>
4-
53
<p><%= t('.greeting', recipient_name: @recipient.name) %></p>
64

7-
<p><%= t('.message_intro', conversation: @conversation.title) %></p>
8-
9-
<blockquote style="border-left: 4px solid #ccc; padding-left: 10px; margin: 10px 0;">
10-
<p><strong><%= @sender.name %>:</strong></p>
11-
<p><%= @message.content %></p>
12-
<P><small class="text-muted"><%= l(@message.created_at, format: :short) %></small></P>
13-
</blockquote>
5+
<p><%= t('.message_intro', sender_name: @sender.name) %></p>
146

157
<p><%= t('.view_conversation') %></p>
168

179
<p><%= link_to conversation_url(@conversation), conversation_url(@conversation) %></p>
1810

19-
<p><%= t('.signature', platform: @platform.name) %></p>
11+
<p><%= t('.signature_html', platform: @platform.name) %></p>

config/locales/en.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,13 +627,15 @@ en:
627627
add: Add Contact
628628
conversation_mailer:
629629
new_message_notification:
630+
from_address: '%{sender_name} via %{from_address}'
630631
greeting: Hello %{recipient_name},
631-
message_intro: 'You have a new message in the conversation "%{conversation}":'
632+
message_intro: 'You have an unread message from %{sender_name}:'
632633
signature: Signature
633634
signature_html: |-
634635
Best regards,<br />
635636
The %{platform} Team
636-
subject: '[%{platform}] New message in conversation "%{conversation}"'
637+
subject: 'Your conversation has an unread message'
638+
subject_with_title: '[%{conversation}] conversation has an unread message'
637639
view_conversation: 'You can view and reply to this message by clicking the
638640
link below:'
639641
conversations:

config/locales/es.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,13 +630,15 @@ es:
630630
add: Agregar Contacto
631631
conversation_mailer:
632632
new_message_notification:
633+
from_address: '%{sender_name} por %{from_address}'
633634
greeting: Hola %{recipient_name},
634-
message_intro: 'Tienes un nuevo mensaje en la conversación "%{conversation}":'
635+
message_intro: 'Tienes un mensaje sin leer de %{sender_name}'
635636
signature: Signature
636637
signature_html: |-
637638
Saludos cordiales,<br />
638639
El equipo de %{platform}
639-
subject: '[%{platform}] Nuevo mensaje en la conversación "%{conversation}"'
640+
subject: 'Tu conversación tiene un mensaje sin leer'
641+
subject_with_title: '[%{conversation}] tiene un mensaje sin leer'
640642
view_conversation: 'Puedes ver y responder a este mensaje haciendo clic en
641643
el enlace a continuación:'
642644
conversations:

config/locales/fr.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,12 +633,14 @@ fr:
633633
conversation_mailer:
634634
new_message_notification:
635635
greeting: Bonjour %{recipient_name},
636-
message_intro: 'Vous avez un nouveau message dans la conversation "%{conversation}":'
636+
from_address: '%{sender_name} via %{from_address}'
637+
message_intro: 'Vous avez un message non lu de %{sender_name}'
637638
signature: Signature
638639
signature_html: |-
639640
Cordialement,<br />
640641
L'équipe de %{platform}
641-
subject: '[%{platform}] Nouveau message dans la conversation "%{conversation}"'
642+
subject: 'Votre conversation contient un message non lu'
643+
subject_with_title: '[%{conversation}] contient un message non lu'
642644
view_conversation: 'Vous pouvez voir et répondre à ce message en cliquant
643645
sur le lien ci-dessous :'
644646
conversations:

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ x-app-shared: &app-shared
2020
depends_on:
2121
- db
2222
- redis
23+
- elasticsearch
2324

2425
services:
2526
app: &app

spec/factories/better_together/people.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ module BetterTogether
77
factory :better_together_person, class: Person, aliases: %i[person inviter invitee creator author] do
88
id { Faker::Internet.uuid }
99
name { Faker::Name.name }
10-
description { Faker::Lorem.paragraphs(number: 3) }
11-
identifier { Faker::Internet.unique.username(specifier: 5..10) }
10+
description { Faker::Lorem.paragraph(sentence_count: 3) }
11+
identifier { Faker::Internet.unique.username(specifier: 8..12) }
1212

1313
community
1414
end

spec/mailers/better_together/conversation_mailer_spec.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@ module BetterTogether
1717
end
1818

1919
it 'renders the headers' do
20-
expect(mail.subject).to eq("[#{host_platform.name}] New message in conversation \"#{conversation.title}\"")
21-
expect(mail.to).to eq([recipient.email])
22-
expect(mail.from).to eq(['[email protected]'])
20+
expect(mail.subject).to have_content('conversation has an unread message')
21+
expect(mail.to).to include(recipient.email)
22+
expect(mail.from).to include('[email protected]')
2323
end
2424

2525
it 'renders the body' do
2626
expect(mail.body.encoded).to have_content("Hello #{recipient.person.name}")
27-
expect(mail.body.encoded).to have_content("#{sender.person.name}:")
28-
expect(mail.body.encoded).to have_content(message.content.to_plain_text)
27+
expect(mail.body.encoded).to have_content("You have an unread message from #{sender.person.name}:")
2928
end
3029

3130
it 'sends a message notification email' do

spec/mailers/previews/better_together/conversation_mailer_preview.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ class ConversationMailerPreview < ActionMailer::Preview
88

99
# Preview this email at http://localhost:3000/rails/mailers/better_together/conversation_mailer/new_message_notification
1010
def new_message_notification
11-
host_platform || create(:platform)
12-
sender = create(:user)
13-
recipient = create(:user)
11+
host_platform || create(:platform, :host)
12+
sender = create(:user, :confirmed)
13+
recipient = create(:user, :confirmed)
1414
conversation = create(:conversation, creator: sender.person)
1515
message = create(:message, conversation: conversation, sender: sender.person)
1616

0 commit comments

Comments
 (0)