FEATURE: send push notif if available on reminder

This commit is contained in:
jjaffeux 2020-08-20 19:28:34 +02:00
parent 2f45fd7633
commit c3cd29f2e5
2 changed files with 16 additions and 0 deletions

View File

@ -42,6 +42,10 @@ en:
more_than_two_dates: "A post of a calendar topic cant contain more than two dates."
event_expired: "Event expired"
discourse_post_event:
notifications:
before_event_reminder: "%{title} is about to start."
after_event_reminder: "%{title} has ended."
ongoing_event_reminder: "%{title} is ongoing."
errors:
bulk_invite:
max_invitees: "First %{max_invittes} invitees have been created. Try splitting the file in smaller parts."

View File

@ -51,6 +51,18 @@ module Jobs
message: "discourse_post_event.notifications.#{prefix}_event_reminder"
}.to_json
)
PostAlerter.new(event.post).create_notification_alert(
user: invitee.user,
post: event.post,
username: invitee.user.username,
notification_type: Notification.types[:event_reminder] || Notification.types[:custom],
excerpt: I18n.t(
"discourse_post_event.notifications.#{prefix}_event_reminder",
title: event.name || event.post.topic.title,
locale: invitee.user.effective_locale
)
)
end
end
end