diff --git a/backend/integration_test/delivery_test.go b/backend/integration_test/delivery_test.go
index 9fbff70..afcfdeb 100644
--- a/backend/integration_test/delivery_test.go
+++ b/backend/integration_test/delivery_test.go
@@ -42,8 +42,9 @@ const (
deliveryAccount = "integration"
deliveryOtherAccount = "integration-eu"
deliveryMessageID = "4ef9a417-02e9-4d39-ad75-9611e0fcc33c"
- // deliveryV2Version is a template version that exists only in this test.
- deliveryV2Version = "notification.v2"
+ // deliveryLaterVersion is a template version that exists only in this test:
+ // it is later than the committed notification.v2.
+ deliveryLaterVersion = "notification.v3"
// renamedDeliveryConsumer replays requests as a renamed consumer would:
// the dedup markers of the real name do not apply to it.
renamedDeliveryConsumer = "notification_delivery_replay"
@@ -91,12 +92,12 @@ func (buffer *syncBuffer) String() string {
return buffer.buffer.String()
}
-// v2Renderer stands for a later template version: it renders other copy
-// under notification.v2 without touching the committed templates.
-type v2Renderer struct{}
+// laterVersionRenderer stands for a later template version: it renders other
+// copy under deliveryLaterVersion without touching the committed templates.
+type laterVersionRenderer struct{}
-func (v2Renderer) RenderNotification(mailtemplate.NotificationData) (domain.MailContent, error) {
- return domain.NewMailContent(domain.MailKindNotification, deliveryV2Version,
+func (laterVersionRenderer) RenderNotification(mailtemplate.NotificationData) (domain.MailContent, error) {
+ return domain.NewMailContent(domain.MailKindNotification, deliveryLaterVersion,
"Новая версия письма", "Текст новой версии шаблона.\n", "
Текст новой версии шаблона.
\n")
}
@@ -181,7 +182,7 @@ func TestMailDelivery(t *testing.T) {
t.Fatal("the delivery does not name the event it came from")
case delivery.RecipientUserID() != recipient.ID || delivery.Recipient().Address() != deliveryRecipientAddress:
t.Fatal("the delivery is not addressed to the recipient account")
- case delivery.Kind() != domain.MailKindNotification || content.TemplateVersion() != "notification.v1":
+ case delivery.Kind() != domain.MailKindNotification || content.TemplateVersion() != "notification.v2":
t.Fatalf("delivery kind %s, version %s", delivery.Kind(), content.TemplateVersion())
case delivery.ProviderAccount() != harness.account:
t.Fatal("the delivery is not pinned to the configured provider account")
@@ -203,22 +204,22 @@ func TestMailDelivery(t *testing.T) {
harness.apply(ctx, t, notification.DeliveryConsumerName, harness.handler, firstEvent)
original := harness.getDelivery(ctx, t, pool, first)
- // The template moves to notification.v2. A new request gets the new
+ // The template moves on to a later version. A new request gets the new
// version; a replay of the first request under another consumer name
// finds the request consumed and stores nothing.
- v2Handler := harness.newHandler(v2Renderer{})
+ laterHandler := harness.newHandler(laterVersionRenderer{})
second := harness.requestNotification(ctx, t, recipient)
- harness.apply(ctx, t, notification.DeliveryConsumerName, v2Handler, harness.outboxEvent(ctx, t, second))
- harness.apply(ctx, t, renamedDeliveryConsumer, v2Handler, firstEvent)
+ harness.apply(ctx, t, notification.DeliveryConsumerName, laterHandler, harness.outboxEvent(ctx, t, second))
+ harness.apply(ctx, t, renamedDeliveryConsumer, laterHandler, firstEvent)
assertRowCount(ctx, t, pool, pgx.Identifier{"deliveries"}, 2)
- if got := harness.getDelivery(ctx, t, pool, second).Content(); got.TemplateVersion() != deliveryV2Version {
- t.Fatalf("the new request rendered %s, want %s", got.TemplateVersion(), deliveryV2Version)
+ if got := harness.getDelivery(ctx, t, pool, second).Content(); got.TemplateVersion() != deliveryLaterVersion {
+ t.Fatalf("the new request rendered %s, want %s", got.TemplateVersion(), deliveryLaterVersion)
}
// Read through a fresh pool and store, as another instance would.
kept := harness.getDelivery(ctx, t, newPoolFor(ctx, t, env.Config.DatabaseURL), first).Content()
want := original.Content()
- if kept.TemplateVersion() != "notification.v1" || kept.Subject() != want.Subject() ||
+ if kept.TemplateVersion() != "notification.v2" || kept.Subject() != want.Subject() ||
kept.Text() != want.Text() || kept.HTML() != want.HTML() || kept.Hash() != want.Hash() {
t.Fatal("the stored delivery changed after the template version changed")
}
diff --git a/backend/internal/usecase/notification/mailtemplate/renderer.go b/backend/internal/usecase/notification/mailtemplate/renderer.go
index f4bd9f9..b6e0914 100644
--- a/backend/internal/usecase/notification/mailtemplate/renderer.go
+++ b/backend/internal/usecase/notification/mailtemplate/renderer.go
@@ -42,9 +42,9 @@ type TemplateVersion string
// The versions that new renderings use. Changing copy means adding new
// template files with the next version and pointing the constant at them.
const (
- currentVerificationVersion TemplateVersion = "verification.v2"
- currentPasswordResetVersion TemplateVersion = "password_reset.v1"
- currentNotificationVersion TemplateVersion = "notification.v1"
+ currentVerificationVersion TemplateVersion = "verification.v3"
+ currentPasswordResetVersion TemplateVersion = "password_reset.v2"
+ currentNotificationVersion TemplateVersion = "notification.v2"
)
const (
diff --git a/backend/internal/usecase/notification/mailtemplate/renderer_test.go b/backend/internal/usecase/notification/mailtemplate/renderer_test.go
index 9e7340c..0efa925 100644
--- a/backend/internal/usecase/notification/mailtemplate/renderer_test.go
+++ b/backend/internal/usecase/notification/mailtemplate/renderer_test.go
@@ -118,9 +118,9 @@ func assertGolden(t *testing.T, path, got string) {
func TestRenderingCarriesKindAndVersion(t *testing.T) {
want := map[Kind]TemplateVersion{
- KindVerification: "verification.v2",
- KindPasswordReset: "password_reset.v1",
- KindNotification: "notification.v1",
+ KindVerification: "verification.v3",
+ KindPasswordReset: "password_reset.v2",
+ KindNotification: "notification.v2",
}
for kind, mail := range renderAll(t, newTestRenderer(t)) {
if mail.Kind() != kind || mail.TemplateVersion() != want[kind] {
diff --git a/backend/internal/usecase/notification/mailtemplate/templates/notification.v2.html.tmpl b/backend/internal/usecase/notification/mailtemplate/templates/notification.v2.html.tmpl
new file mode 100644
index 0000000..8825c26
--- /dev/null
+++ b/backend/internal/usecase/notification/mailtemplate/templates/notification.v2.html.tmpl
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+{{.Subject}}
+
+
+Уведомление в личном кабинете Lincodex.
+
+
+
+
+
+| Lincodex |
+
+
+|
+ УВЕДОМЛЕНИЕ
+{{.Subject}}
+{{range .View.Paragraphs}}{{range $index, $line := .}}{{if $index}} {{end}}{{$line}}{{end}}
+{{end}}
+Если кнопка не работает, скопируйте ссылку в адресную строку браузера:
+{{.View.Link}}
+ |
+
+
+|
+ Вы получили это письмо, потому что в Lincodex пришло уведомление на ваш подтвержденный адрес.
+Lincodex. Письмо отправлено автоматически, отвечать на него не нужно.
+ |
+
+
+ |
+
+
+
+
diff --git a/backend/internal/usecase/notification/mailtemplate/templates/notification.v2.subject.tmpl b/backend/internal/usecase/notification/mailtemplate/templates/notification.v2.subject.tmpl
new file mode 100644
index 0000000..4478742
--- /dev/null
+++ b/backend/internal/usecase/notification/mailtemplate/templates/notification.v2.subject.tmpl
@@ -0,0 +1 @@
+{{.Subject}}
diff --git a/backend/internal/usecase/notification/mailtemplate/templates/notification.v2.txt.tmpl b/backend/internal/usecase/notification/mailtemplate/templates/notification.v2.txt.tmpl
new file mode 100644
index 0000000..cce4c00
--- /dev/null
+++ b/backend/internal/usecase/notification/mailtemplate/templates/notification.v2.txt.tmpl
@@ -0,0 +1,11 @@
+{{.Subject}}
+
+{{.View.TextBody}}
+
+Подробнее в личном кабинете:
+
+{{.View.Link}}
+
+--
+Вы получили это письмо, потому что в Lincodex пришло уведомление на ваш подтвержденный адрес.
+Lincodex. Письмо отправлено автоматически, отвечать на него не нужно.
diff --git a/backend/internal/usecase/notification/mailtemplate/templates/password_reset.v2.html.tmpl b/backend/internal/usecase/notification/mailtemplate/templates/password_reset.v2.html.tmpl
new file mode 100644
index 0000000..e32e508
--- /dev/null
+++ b/backend/internal/usecase/notification/mailtemplate/templates/password_reset.v2.html.tmpl
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+{{.Subject}}
+
+
+Откройте ссылку, чтобы задать новый пароль в Lincodex.
+
+
+
+
+
+| Lincodex |
+
+
+|
+ ВОССТАНОВЛЕНИЕ ДОСТУПА
+Сброс пароля
+Мы получили запрос на сброс пароля для аккаунта Lincodex, связанного с этим адресом. Чтобы задать новый пароль, откройте ссылку.
+
+Если кнопка не работает, скопируйте ссылку в адресную строку браузера:
+{{.View.Link}}
+Ссылка действует {{.View.LifetimeHours}} {{plural .View.LifetimeHours "час" "часа" "часов"}}.
+Если вы не запрашивали сброс, просто не открывайте ссылку: текущий пароль останется прежним.
+ |
+
+
+|
+ Вы получили это письмо, потому что для аккаунта Lincodex с этим адресом запросили сброс пароля.
+Lincodex. Письмо отправлено автоматически, отвечать на него не нужно.
+ |
+
+
+ |
+
+
+
+
diff --git a/backend/internal/usecase/notification/mailtemplate/templates/password_reset.v2.subject.tmpl b/backend/internal/usecase/notification/mailtemplate/templates/password_reset.v2.subject.tmpl
new file mode 100644
index 0000000..93cb8b5
--- /dev/null
+++ b/backend/internal/usecase/notification/mailtemplate/templates/password_reset.v2.subject.tmpl
@@ -0,0 +1 @@
+Сброс пароля в Lincodex
diff --git a/backend/internal/usecase/notification/mailtemplate/templates/password_reset.v2.txt.tmpl b/backend/internal/usecase/notification/mailtemplate/templates/password_reset.v2.txt.tmpl
new file mode 100644
index 0000000..0adb27f
--- /dev/null
+++ b/backend/internal/usecase/notification/mailtemplate/templates/password_reset.v2.txt.tmpl
@@ -0,0 +1,13 @@
+Сброс пароля
+
+Мы получили запрос на сброс пароля для аккаунта Lincodex, связанного с этим адресом. Чтобы задать новый пароль, откройте ссылку:
+
+{{.View.Link}}
+
+Ссылка действует {{.View.LifetimeHours}} {{plural .View.LifetimeHours "час" "часа" "часов"}}.
+
+Если вы не запрашивали сброс, просто не открывайте ссылку: текущий пароль останется прежним.
+
+--
+Вы получили это письмо, потому что для аккаунта Lincodex с этим адресом запросили сброс пароля.
+Lincodex. Письмо отправлено автоматически, отвечать на него не нужно.
diff --git a/backend/internal/usecase/notification/mailtemplate/templates/verification.v3.html.tmpl b/backend/internal/usecase/notification/mailtemplate/templates/verification.v3.html.tmpl
new file mode 100644
index 0000000..8faea48
--- /dev/null
+++ b/backend/internal/usecase/notification/mailtemplate/templates/verification.v3.html.tmpl
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+{{.Subject}}
+
+
+Введите код или откройте ссылку, чтобы подтвердить почту в Lincodex.
+
+
+
+
+
+| Lincodex |
+
+
+|
+ РЕГИСТРАЦИЯ
+Подтвердите адрес почты
+Чтобы завершить регистрацию в Lincodex, введите код на странице подтверждения вместе с паролем, который вы выбрали при регистрации.
+Код подтверждения
+
+Код действует {{.View.CodeLifetimeMinutes}} {{plural .View.CodeLifetimeMinutes "минуту" "минуты" "минут"}}.
+Или откройте ссылку и подтвердите адрес на открывшейся странице:
+
+Если кнопка не работает, скопируйте ссылку в адресную строку браузера:
+{{.View.Link}}
+Ссылка действует {{.View.LifetimeHours}} {{plural .View.LifetimeHours "час" "часа" "часов"}}.
+Если вы не регистрировались в Lincodex, ничего не делайте: без подтверждения аккаунт не будет активирован.
+ |
+
+
+|
+ Вы получили это письмо, потому что этот адрес указали при регистрации в Lincodex.
+Lincodex. Письмо отправлено автоматически, отвечать на него не нужно.
+ |
+
+
+ |
+
+
+
+
diff --git a/backend/internal/usecase/notification/mailtemplate/templates/verification.v3.subject.tmpl b/backend/internal/usecase/notification/mailtemplate/templates/verification.v3.subject.tmpl
new file mode 100644
index 0000000..e2eafe9
--- /dev/null
+++ b/backend/internal/usecase/notification/mailtemplate/templates/verification.v3.subject.tmpl
@@ -0,0 +1 @@
+Подтвердите почту в Lincodex
diff --git a/backend/internal/usecase/notification/mailtemplate/templates/verification.v3.txt.tmpl b/backend/internal/usecase/notification/mailtemplate/templates/verification.v3.txt.tmpl
new file mode 100644
index 0000000..ccd5f0f
--- /dev/null
+++ b/backend/internal/usecase/notification/mailtemplate/templates/verification.v3.txt.tmpl
@@ -0,0 +1,19 @@
+Подтвердите адрес почты
+
+Чтобы завершить регистрацию в Lincodex, введите код на странице подтверждения вместе с паролем, который вы выбрали при регистрации:
+
+Код подтверждения: {{.View.Code}}
+
+Код действует {{.View.CodeLifetimeMinutes}} {{plural .View.CodeLifetimeMinutes "минуту" "минуты" "минут"}}.
+
+Или откройте ссылку и подтвердите адрес на открывшейся странице:
+
+{{.View.Link}}
+
+Ссылка действует {{.View.LifetimeHours}} {{plural .View.LifetimeHours "час" "часа" "часов"}}.
+
+Если вы не регистрировались в Lincodex, ничего не делайте: без подтверждения аккаунт не будет активирован.
+
+--
+Вы получили это письмо, потому что этот адрес указали при регистрации в Lincodex.
+Lincodex. Письмо отправлено автоматически, отвечать на него не нужно.
diff --git a/backend/internal/usecase/notification/mailtemplate/testdata/notification.v1.html.golden b/backend/internal/usecase/notification/mailtemplate/testdata/notification.v1.html.golden
deleted file mode 100644
index b2de8aa..0000000
--- a/backend/internal/usecase/notification/mailtemplate/testdata/notification.v1.html.golden
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-Приглашение <script>alert("x")</script> & 'кавычки' X-Injected: yes
-
-
-
-
-
Lincodex. Письмо отправлено автоматически, отвечать на него не нужно.
-
-
-
diff --git a/backend/internal/usecase/notification/mailtemplate/testdata/notification.v2.html.golden b/backend/internal/usecase/notification/mailtemplate/testdata/notification.v2.html.golden
new file mode 100644
index 0000000..e0ddfb1
--- /dev/null
+++ b/backend/internal/usecase/notification/mailtemplate/testdata/notification.v2.html.golden
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+Приглашение <script>alert("x")</script> & 'кавычки' X-Injected: yes
+
+
+Уведомление в личном кабинете Lincodex.
+
+
+
+
+
+| Lincodex |
+
+
+|
+ УВЕДОМЛЕНИЕ
+Приглашение <script>alert("x")</script> & 'кавычки' X-Injected: yes
+Компания "Тест & Ко" <b>пригласила</b> вас. Вторая строкареверс
+Второй абзац: ёжик 🚀 <img src=x onerror=alert(1)>
+
+Если кнопка не работает, скопируйте ссылку в адресную строку браузера:
+https://lincodex.example/candidate/invitations
+ |
+
+
+|
+ Вы получили это письмо, потому что в Lincodex пришло уведомление на ваш подтвержденный адрес.
+Lincodex. Письмо отправлено автоматически, отвечать на него не нужно.
+ |
+
+
+ |
+
+
+
+
diff --git a/backend/internal/usecase/notification/mailtemplate/testdata/notification.v1.txt.golden b/backend/internal/usecase/notification/mailtemplate/testdata/notification.v2.txt.golden
similarity index 78%
rename from backend/internal/usecase/notification/mailtemplate/testdata/notification.v1.txt.golden
rename to backend/internal/usecase/notification/mailtemplate/testdata/notification.v2.txt.golden
index 65870d1..09b2cfb 100644
--- a/backend/internal/usecase/notification/mailtemplate/testdata/notification.v1.txt.golden
+++ b/backend/internal/usecase/notification/mailtemplate/testdata/notification.v2.txt.golden
@@ -12,4 +12,5 @@ Subject: Приглашение & 'кавычки' X
https://lincodex.example/candidate/invitations
--
+Вы получили это письмо, потому что в Lincodex пришло уведомление на ваш подтвержденный адрес.
Lincodex. Письмо отправлено автоматически, отвечать на него не нужно.
diff --git a/backend/internal/usecase/notification/mailtemplate/testdata/password_reset.v1.html.golden b/backend/internal/usecase/notification/mailtemplate/testdata/password_reset.v1.html.golden
deleted file mode 100644
index 05431ad..0000000
--- a/backend/internal/usecase/notification/mailtemplate/testdata/password_reset.v1.html.golden
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-Сброс пароля в Lincodex
-
-
-
-
-
Lincodex. Письмо отправлено автоматически, отвечать на него не нужно.
-
-
-
diff --git a/backend/internal/usecase/notification/mailtemplate/testdata/password_reset.v2.html.golden b/backend/internal/usecase/notification/mailtemplate/testdata/password_reset.v2.html.golden
new file mode 100644
index 0000000..42100d7
--- /dev/null
+++ b/backend/internal/usecase/notification/mailtemplate/testdata/password_reset.v2.html.golden
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+Сброс пароля в Lincodex
+
+
+Откройте ссылку, чтобы задать новый пароль в Lincodex.
+
+
+
+
+
+| Lincodex |
+
+
+|
+ ВОССТАНОВЛЕНИЕ ДОСТУПА
+Сброс пароля
+Мы получили запрос на сброс пароля для аккаунта Lincodex, связанного с этим адресом. Чтобы задать новый пароль, откройте ссылку.
+
+Если кнопка не работает, скопируйте ссылку в адресную строку браузера:
+https://lincodex.example/reset-password#token=SyntheticToken_0123456789-abcdefghijklmnopqrstuv
+Ссылка действует 1 час.
+Если вы не запрашивали сброс, просто не открывайте ссылку: текущий пароль останется прежним.
+ |
+
+
+|
+ Вы получили это письмо, потому что для аккаунта Lincodex с этим адресом запросили сброс пароля.
+Lincodex. Письмо отправлено автоматически, отвечать на него не нужно.
+ |
+
+
+ |
+
+
+
+
diff --git a/backend/internal/usecase/notification/mailtemplate/testdata/password_reset.v1.txt.golden b/backend/internal/usecase/notification/mailtemplate/testdata/password_reset.v2.txt.golden
similarity index 81%
rename from backend/internal/usecase/notification/mailtemplate/testdata/password_reset.v1.txt.golden
rename to backend/internal/usecase/notification/mailtemplate/testdata/password_reset.v2.txt.golden
index e59fa5a..b28a4cf 100644
--- a/backend/internal/usecase/notification/mailtemplate/testdata/password_reset.v1.txt.golden
+++ b/backend/internal/usecase/notification/mailtemplate/testdata/password_reset.v2.txt.golden
@@ -11,4 +11,5 @@ https://lincodex.example/reset-password#token=SyntheticToken_0123456789-abcdefgh
Если вы не запрашивали сброс, просто не открывайте ссылку: текущий пароль останется прежним.
--
+Вы получили это письмо, потому что для аккаунта Lincodex с этим адресом запросили сброс пароля.
Lincodex. Письмо отправлено автоматически, отвечать на него не нужно.
diff --git a/backend/internal/usecase/notification/mailtemplate/testdata/verification.v2.html.golden b/backend/internal/usecase/notification/mailtemplate/testdata/verification.v2.html.golden
deleted file mode 100644
index 484ba70..0000000
--- a/backend/internal/usecase/notification/mailtemplate/testdata/verification.v2.html.golden
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-Подтвердите почту в Lincodex
-
-
-
-
-
Lincodex
-
Подтвердите адрес почты
-
Чтобы завершить регистрацию в Lincodex, введите код на странице подтверждения вместе с паролем, который вы выбрали при регистрации.
-
Код подтверждения:
-
482915
-
Код действует 30 минут.
-
Или откройте ссылку и подтвердите адрес на открывшейся странице:
-
Подтвердить почту
-
Если кнопка не работает, скопируйте ссылку в адресную строку браузера:
-
https://lincodex.example/verify-email#token=SyntheticToken_0123456789-abcdefghijklmnopqrstuv
-
Ссылка действует 24 часа.
-
Если вы не регистрировались в Lincodex, ничего не делайте: без подтверждения аккаунт не будет активирован.
-
-
Lincodex. Письмо отправлено автоматически, отвечать на него не нужно.
-
-
-
diff --git a/backend/internal/usecase/notification/mailtemplate/testdata/verification.v3.html.golden b/backend/internal/usecase/notification/mailtemplate/testdata/verification.v3.html.golden
new file mode 100644
index 0000000..fe5f775
--- /dev/null
+++ b/backend/internal/usecase/notification/mailtemplate/testdata/verification.v3.html.golden
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+Подтвердите почту в Lincodex
+
+
+Введите код или откройте ссылку, чтобы подтвердить почту в Lincodex.
+
+
+
+
+
+| Lincodex |
+
+
+|
+ РЕГИСТРАЦИЯ
+Подтвердите адрес почты
+Чтобы завершить регистрацию в Lincodex, введите код на странице подтверждения вместе с паролем, который вы выбрали при регистрации.
+Код подтверждения
+
+Код действует 30 минут.
+Или откройте ссылку и подтвердите адрес на открывшейся странице:
+
+Если кнопка не работает, скопируйте ссылку в адресную строку браузера:
+https://lincodex.example/verify-email#token=SyntheticToken_0123456789-abcdefghijklmnopqrstuv
+Ссылка действует 24 часа.
+Если вы не регистрировались в Lincodex, ничего не делайте: без подтверждения аккаунт не будет активирован.
+ |
+
+
+|
+ Вы получили это письмо, потому что этот адрес указали при регистрации в Lincodex.
+Lincodex. Письмо отправлено автоматически, отвечать на него не нужно.
+ |
+
+
+ |
+
+
+
+
diff --git a/backend/internal/usecase/notification/mailtemplate/testdata/verification.v2.txt.golden b/backend/internal/usecase/notification/mailtemplate/testdata/verification.v3.txt.golden
similarity index 87%
rename from backend/internal/usecase/notification/mailtemplate/testdata/verification.v2.txt.golden
rename to backend/internal/usecase/notification/mailtemplate/testdata/verification.v3.txt.golden
index f159799..ca395fd 100644
--- a/backend/internal/usecase/notification/mailtemplate/testdata/verification.v2.txt.golden
+++ b/backend/internal/usecase/notification/mailtemplate/testdata/verification.v3.txt.golden
@@ -17,4 +17,5 @@ https://lincodex.example/verify-email#token=SyntheticToken_0123456789-abcdefghij
Если вы не регистрировались в Lincodex, ничего не делайте: без подтверждения аккаунт не будет активирован.
--
+Вы получили это письмо, потому что этот адрес указали при регистрации в Lincodex.
Lincodex. Письмо отправлено автоматически, отвечать на него не нужно.
diff --git a/backend/internal/usecase/notification/notification_test.go b/backend/internal/usecase/notification/notification_test.go
index 5395a77..1eaa823 100644
--- a/backend/internal/usecase/notification/notification_test.go
+++ b/backend/internal/usecase/notification/notification_test.go
@@ -293,7 +293,7 @@ func TestDeliveryHandlerStoresTheRenderedRequest(t *testing.T) {
t.Fatal("the delivery does not name its source event")
case delivery.RecipientUserID() != h.recipient.ID || delivery.Recipient().Address() != testRecipientAddress:
t.Fatal("the delivery is not addressed to the account email")
- case delivery.Kind() != domain.MailKindNotification || delivery.Content().TemplateVersion() != "notification.v1":
+ case delivery.Kind() != domain.MailKindNotification || delivery.Content().TemplateVersion() != "notification.v2":
t.Fatalf("the delivery has kind %s and version %s", delivery.Kind(), delivery.Content().TemplateVersion())
case !strings.Contains(delivery.Content().Text(), "PRIVATE-BODY") || !strings.Contains(delivery.Content().Text(), testOrigin+testLinkPath):
t.Fatal("the stored body is not the rendering of the request")
diff --git a/docs/en/DEPLOY.md b/docs/en/DEPLOY.md
index b0a5924..136bd15 100644
--- a/docs/en/DEPLOY.md
+++ b/docs/en/DEPLOY.md
@@ -347,7 +347,7 @@ A worker claims it within one poll interval and runs it with fresh attempts. To
The backend sends mail through the `MailSender` port. `EMAIL_PROVIDER` selects exactly one transport: `resend` (the Resend HTTP API, the primary provider for the working stand), `smtp` (a separate SMTP relay), or `disabled`. It has no default, and there is no fallback: when the selected transport cannot start, the backend stops instead of switching to another one. Settings of transports that are not selected are not read.
-Current state: this build contains the `disabled` and `resend` transports. With `smtp`, the backend validates the SMTP settings and then exits with `EMAIL_PROVIDER=smtp: mail transport is not available in this build`; under Compose, `restart: unless-stopped` restarts the container repeatedly. SMTP is outside the MVP. `.env.example` and `make -C deploy smoke` use `disabled`, so local runs need no key; the working stand sets `EMAIL_PROVIDER=resend` and `RESEND_API_KEY` explicitly. With `EMAIL_PROVIDER=resend`, the backend runs a worker for service identity mail (email verification and password reset), and registration queues a verification email. Password reset is not implemented, and product notifications are stored as deliveries but not sent until product notification sending is implemented. See [Sending service mail](#sending-service-mail).
+Current state: this build contains the `disabled` and `resend` transports. With `smtp`, the backend validates the SMTP settings and then exits with `EMAIL_PROVIDER=smtp: mail transport is not available in this build`; under Compose, `restart: unless-stopped` restarts the container repeatedly. SMTP is outside the MVP. `.env.example` and `make -C deploy smoke` use `disabled`, so local runs need no key; the working stand sets `EMAIL_PROVIDER=resend` and `RESEND_API_KEY` explicitly. With `EMAIL_PROVIDER=resend`, the backend runs a worker for service identity mail (email verification and password reset), and registration queues a verification email. Password reset is not implemented. Product notifications are sent by a separate notification worker: it leaves a quota reserve to service mail and checks the recipient's rights again before every send (see [ARCHITECTURE.md](ARCHITECTURE.md)). See [Sending service mail](#sending-service-mail).
Release compatibility: `ConfirmEmail` requires both `token` and the password selected for that registration. Clients that send only the token must be updated. Migration `00016_bind_registration_consent.sql` adds the registration version to C1 and backfills legacy records from the current account version without requiring a live token. It checks that a registration C1 is not older than the latest registration and that an account has at most one active registration C1; on inconsistency, the migration stops without partial changes. A trigger fills the version when an old backend omits it and rejects a mismatched version sent by the new backend. A partial unique index allows at most one unrevoked registration C1 per account and registration version. Apply the migration before updating the backend. To roll back, deploy the old backend before reverting the migration. No new environment variable is needed. `APP_PUBLIC_URL` also defines the Origin that confirmation requests must send. The new `ConfirmEmailByCode` operation (`POST /api/v1/identity/email-verifications/code`) and migration `00046_add_email_verification_codes.sql` are additive: existing clients keep confirming by link. The migration can be rolled back once no usable code is left; its down step refuses until then.
@@ -376,7 +376,7 @@ Compose passes these variables from the root `.env`; it passes an unset `EMAIL_Q
### Mail deliveries
-A notification request is a row in `mail_requests` until the consumer `notification_delivery` turns it into a row in `deliveries` and deletes it; the model is in [ARCHITECTURE.md](ARCHITECTURE.md#mail-deliveries). Migration 00006 creates `mail_requests`, `deliveries`, and `delivery_attempts` at startup; migration 00017 adds the unknown-outcome decision journal and rebuilds the due partial index under a table lock. Rolling 00017 back drops that journal and its audit history, so export the decisions before rollback. Neither migration needs a setting. Notification deliveries are only stored for now: the sending worker claims verification and password reset mail only, so a notification stays `pending` until product notification sending is implemented. Notifications are created only for accounts with a verified address; a request for an unverified address is dropped with a log line.
+A notification request is a row in `mail_requests` until the consumer `notification_delivery` turns it into a row in `deliveries` and deletes it; the model is in [ARCHITECTURE.md](ARCHITECTURE.md#mail-deliveries). Migration 00006 creates `mail_requests`, `deliveries`, and `delivery_attempts` at startup; migration 00017 adds the unknown-outcome decision journal and rebuilds the due partial index under a table lock. Rolling 00017 back drops that journal and its audit history, so export the decisions before rollback. Neither migration needs a setting. Notification deliveries are sent by a separate notification worker through its own queue; the service mail worker still claims verification and password reset mail only. Notifications are created only for accounts with a verified address; a request for an unverified address is dropped with a log line.
- Each delivery is pinned to `EMAIL_PROVIDER` and `EMAIL_ACCOUNT` at creation, and a later configuration change applies only to new deliveries. Change `EMAIL_ACCOUNT` together with `RESEND_API_KEY` whenever the key belongs to another Resend account, so deliveries that started under the old account are never sent through the new one. Service mail created while `EMAIL_PROVIDER=disabled` stays pinned to `disabled` until the backend runs with a transport: the sending worker then moves it with `Rebind` (allowed only before the first attempt) and sends it if its token and account still pass the check. Do not rebind by hand. Product notifications follow the same rule, and their loop rebinds them the same way.
- The rows hold the recipient address and the rendered bodies, and a waiting `mail_requests` row holds the raw notification text; verification and password reset bodies hold a live one-time token until it is used or expires. Treat read access to `deliveries` like access to those links, and keep database dumps and backups under the same protection. Retention of finished deliveries is not implemented yet.
@@ -422,6 +422,7 @@ Implemented: the renderer in `backend/internal/usecase/notification/mailtemplate
- Templates are embedded in the binary with `go:embed` and parsed once when the renderer is created; a broken template fails its creation. Each version has three files: `.v.subject.tmpl`, `.v.txt.tmpl`, and `.v.html.tmpl`. The HTML part uses `html/template`, the plain-text part and the subject use `text/template`. Every transport sends the same rendering; templates hold no provider settings, keys, or sender address.
- Links start with `APP_PUBLIC_URL`, which the renderer checks again with the same rules. Verification: `/verify-email#token=`; password reset: `/reset-password#token=` (the page and the API for the reset are planned). The token is only in the URL fragment, never in the path or the query: a browser does not send the fragment to a server, so the nginx access log (which records `$uri`) and Referer headers never hold it. The frontend reads and removes the fragment, waits for explicit user action, then sends the token and registration password to the API. A notification link is a path inside the application, such as `/candidate/invitations`; an absolute URL, `//host`, a scheme such as `javascript:`, a query, a fragment, a percent sign, and `.` or `..` segments are rejected.
- Messages contain no name, email address, or other contact. Caller text in a notification is escaped in the HTML part; control and bidirectional characters are removed from the plain-text part, and the subject becomes one line, so CR and LF cannot add header lines. The notification subject is limited to 100 characters and the body to 2000.
+- The HTML part uses table layout with inline styles only: no `