Skip to content

Commit

Permalink
Send object id in the notification
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertoMoreta committed Mar 18, 2024
1 parent e1e0d5a commit 9ac83d0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion helpers/fcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def broadcast_notification(node_shortname=None, data=None, event=NotificationEve
logger.info("Sending FCM broadcast...")
try:
data = data or {}
data["event"] = str(event.title)
data["event"] = str(event.prefix)

if not body and not title:
silent = True
Expand Down
1 change: 1 addition & 0 deletions news/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def form_valid(self, form):
title=news.title,
body=news.short_description,
image=self.request.build_absolute_uri(news.banner_thumbnail.url) if news.banner_thumbnail.name else None,
data={"id": str(news.pk)}
)

return HttpResponseRedirect(self.get_success_url())
Expand Down
2 changes: 1 addition & 1 deletion offers/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def form_valid(self, form):
event=NotificationEvent.OFFER_ADDED,
title=offer.title,
body=offer.description,
data={'proveedora': offer.provider.name},
data={'proveedora': offer.provider.name, 'id': str(offer.pk)},
image=self.request.build_absolute_uri(offer.banner_thumbnail.url) if offer.banner_thumbnail.name else None,
)

Expand Down

0 comments on commit 9ac83d0

Please sign in to comment.