Skip to content

Commit

Permalink
fix: must be a json
Browse files Browse the repository at this point in the history
  • Loading branch information
LuisCusihuaman committed Dec 6, 2023
1 parent b3d3c37 commit a43a96f
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions identity_socializer/services/push_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,19 +190,20 @@ async def new_message(
return

chat_dict = {
"id": str(chat.id),
"owner_id": chat.owner_id,
"other_id": chat.other_id,
"created_at": str(chat.created_at),
"id": str(chat.id),
"owner_id": chat.owner_id,
"other_id": chat.other_id,
"created_at": str(chat.created_at),
}

# Create and save notification to database
title = "You have a new message!"
body = f"@{user.username} sent you a message!"

data = {
# Prepare notification data
notification_data = {
"screen": "NewMessageNotification",
"params": {
"params": {
"chat": chat_dict,
"user": _user_json_format(user),
},
Expand All @@ -215,14 +216,7 @@ async def new_message(
# Send push notification to user
push_tokens = await push_token_dao.get_push_tokens_by_user(to_id)
for push_token in push_tokens:

data = {
"screen": "NewMessageNotification",
"params": {"chat": chat, "user": _user_json_format(user)},
}

notification = _create_push_notification(push_token, title, body, data)

notification = _create_push_notification(push_token, title, body, notification_data)
self.send(notification)


Expand Down

0 comments on commit a43a96f

Please sign in to comment.