lastMessage in chat (#1606)

* lastMessage in chat

* lastMessage info

* Update src/util/Injected.js

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>

* fix  serialize msg

* markup

---------

Co-authored-by: tofers <tofers90>
Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
This commit is contained in:
tofers 2023-04-01 17:07:39 +03:00 • committed by GitHub
commit 812ff0ddfc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -427,7 +427,15 @@ exports.LoadUtils = () => {
await window.Store.GroupMetadata.update(chatWid);
res.groupMetadata = chat.groupMetadata.serialize();
}
res.lastMessage = null;
if (res.msgs && res.msgs.length) {
const lastMessage = window.Store.Msg.get(chat.lastReceivedKey._serialized);
if (lastMessage) {
res.lastMessage = window.WWebJS.getMessageModel(lastMessage);
}
}
delete res.msgs;
delete res.msgUnsyncedButtonReplyMsgs;
delete res.unsyncedButtonReplies;