mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
fix(tests): do not error when test chat messages miss the timestamp attribute
This commit is contained in:
@@ -348,7 +348,7 @@ schema.statics.toJSONCleanChat = async function groupToJSONCleanChat (group, use
|
|||||||
toJSON.chat.forEach(chat => {
|
toJSON.chat.forEach(chat => {
|
||||||
// old chats are saved with a numeric timestamp
|
// old chats are saved with a numeric timestamp
|
||||||
// new chats use `Date` which then has to be converted to the numeric timestamp
|
// new chats use `Date` which then has to be converted to the numeric timestamp
|
||||||
if (chat.timestamp.getTime) {
|
if (chat.timestamp && chat.timestamp.getTime) {
|
||||||
chat.timestamp = chat.timestamp.getTime();
|
chat.timestamp = chat.timestamp.getTime();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user