Add group chat functions, slight refactoring
This commit is contained in:
parent
594a65d5e8
commit
1b7376885d
1 changed files with 316 additions and 37 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue