Add group chat functions, slight refactoring

This commit is contained in:
Pedro Lopez
2019-02-20 02:42:19 -04:00
parent 594a65d5e8
commit 1b7376885d
12 changed files with 316 additions and 37 deletions

View File

@@ -56,6 +56,27 @@ exports.LoadExtraProps = (model, props) => {
Store[model].models[0].__props = Store[model].models[0].__props.concat(props);
}
exports.LoadCustomSerializers = () => {
window.WWebJS = {};
window.WWebJS.getChatModel = chat => {
let res = chat.serialize();
res.isGroup = chat.isGroup;
res.formattedTitle = chat.formattedTitle;
if(chat.groupMetadata) {
res.groupMetadata = chat.groupMetadata.serialize();
}
return res;
}
window.WWebJS.getChat = chatId => {
const chat = Store.Chat.get(chatId);
return WWebJS.getChatModel(chat);
}
}
exports.MarkAllRead = () => {
let Chats = Store.Chat.models;