extract chat (#10362)
* extract chatTextarea from group/tavern - extract staffList array * fix lint / rewrite condition * clean up - part 1 * rename chatTextarea to chat * refactor timestamp check
This commit is contained in:
@@ -346,7 +346,11 @@ schema.statics.toJSONCleanChat = async function groupToJSONCleanChat (group, use
|
||||
|
||||
// Convert to timestamps because Android expects it
|
||||
toJSON.chat.forEach(chat => {
|
||||
chat.timestamp = chat.timestamp ? chat.timestamp.getTime() : new Date().getTime();
|
||||
// old chats are saved with a numeric timestamp
|
||||
// new chats use `Date` which then has to be converted to the numeric timestamp
|
||||
if (chat.timestamp.getTime) {
|
||||
chat.timestamp = chat.timestamp.getTime();
|
||||
}
|
||||
});
|
||||
|
||||
return toJSON;
|
||||
@@ -1537,4 +1541,4 @@ if (!nconf.get('IS_TEST')) {
|
||||
privacy: 'public',
|
||||
}).save();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user