push_notifications: Provide message timestamp in both APNS and GCM notifications.

This commit is contained in:
Alex Vandiver 2023-09-22 18:26:21 +00:00 committed by Tim Abbott
parent b8581e2895
commit fd6091ad17
2 changed files with 8 additions and 1 deletions

View File

@ -803,6 +803,7 @@ def get_message_payload(
# `sender_id` is preferred, but some existing versions use `sender_email`.
data["sender_id"] = message.sender.id
data["sender_email"] = message.sender.email
data["time"] = message.date_sent.timestamp()
if mentioned_user_group_id is not None:
assert mentioned_user_group_name is not None
data["mentioned_user_group_id"] = mentioned_user_group_id
@ -941,7 +942,6 @@ def get_message_payload_gcm(
data.update(
event="message",
zulip_message_id=message.id, # message_id is reserved for CCS
time=message.date_sent.timestamp(),
content=content,
content_truncated=truncated,
sender_full_name=message.sender.full_name,

View File

@ -1981,6 +1981,7 @@ class TestGetAPNsPayload(PushNotificationTest):
"realm_id": self.sender.realm.id,
"realm_uri": self.sender.realm.uri,
"user_id": user_profile.id,
"time": message.date_sent.timestamp(),
},
},
}
@ -2023,6 +2024,7 @@ class TestGetAPNsPayload(PushNotificationTest):
"realm_id": self.sender.realm.id,
"realm_uri": self.sender.realm.uri,
"user_id": user_profile.id,
"time": message.date_sent.timestamp(),
},
},
}
@ -2054,6 +2056,7 @@ class TestGetAPNsPayload(PushNotificationTest):
"realm_id": self.sender.realm.id,
"realm_uri": self.sender.realm.uri,
"user_id": self.sender.id,
"time": message.date_sent.timestamp(),
},
},
}
@ -2091,6 +2094,7 @@ class TestGetAPNsPayload(PushNotificationTest):
"realm_id": self.sender.realm.id,
"realm_uri": self.sender.realm.uri,
"user_id": user_profile.id,
"time": message.date_sent.timestamp(),
},
},
}
@ -2129,6 +2133,7 @@ class TestGetAPNsPayload(PushNotificationTest):
"user_id": user_profile.id,
"mentioned_user_group_id": user_group.id,
"mentioned_user_group_name": user_group.name,
"time": message.date_sent.timestamp(),
}
},
}
@ -2164,6 +2169,7 @@ class TestGetAPNsPayload(PushNotificationTest):
"realm_id": self.sender.realm.id,
"realm_uri": self.sender.realm.uri,
"user_id": user_profile.id,
"time": message.date_sent.timestamp(),
},
},
}
@ -2224,6 +2230,7 @@ class TestGetAPNsPayload(PushNotificationTest):
"realm_id": self.sender.realm.id,
"realm_uri": self.sender.realm.uri,
"user_id": user_profile.id,
"time": message.date_sent.timestamp(),
},
},
}