feat(notify): Web Push subscriptions and email/push prefs.
CI / test (push) Successful in 7m43s
CI / deploy-ift (push) Successful in 3m33s
CI / e2e-ift (push) Successful in 1m28s
CI / deploy-stage (push) Failing after 3m40s
CI / e2e-stage (push) Has been skipped

Prefs in user.preferences; push_subscription table; VAPID send on
reminder/waitlist. Refs EventHub/EventHubBack#75
This commit is contained in:
2026-08-15 20:19:44 +03:00
parent e86d603f30
commit 12274f9ed0
15 changed files with 729 additions and 9 deletions
+15 -4
View File
@@ -422,10 +422,15 @@ maybe_remind(#booking{id = Id, event_id = EventId, user_id = UserId} = Booking,
send_reminder(UserId, Title, Start, CalId, EventId) ->
Path = <<"/c/", CalId/binary, "/e/", EventId/binary>>,
WhenText = format_when(Start),
case core_user:get_by_id(UserId) of
{ok, #user{email = Email}} when is_binary(Email), Email =/= <<>> ->
_ = logic_email:send_booking_reminder(Email, Title, Start, Path);
_ ->
case logic_notification_prefs:email_enabled(UserId) of
true ->
case core_user:get_by_id(UserId) of
{ok, #user{email = Email}} when is_binary(Email), Email =/= <<>> ->
_ = logic_email:send_booking_reminder(Email, Title, Start, Path);
_ ->
ok
end;
false ->
ok
end,
_ = logic_notification:notify_event_reminder(UserId, #{
@@ -435,6 +440,12 @@ send_reminder(UserId, Title, Start, CalId, EventId) ->
start_time => Start,
when_text => WhenText
}),
_ = logic_web_push:send(
UserId,
<<"Напоминание о записи"/utf8>>,
iolist_to_binary([<<"Скоро: «"/utf8>>, Title, <<"» — "/utf8>>, WhenText]),
Path
),
ok.
format_when({{Y, Mo, D}, {H, Mi, _S}}) ->