Skip to content

Commit

Permalink
fix: Fixed message ID generator
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Apr 28, 2021
1 parent c19062f commit 0da9a62
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/lib/wapi/functions/get-new-message-id.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@
*/

export function getNewMessageId(chatId) {
const newMsgId = new Store.MsgKey(
Object.assign({}, Store.Msg.models[0].__x_id)
);

newMsgId.fromMe = true;
newMsgId.id = WAPI.getNewId().toUpperCase();
newMsgId.remote = new Store.WidFactory.createWid(chatId);
newMsgId._serialized = `${newMsgId.fromMe}_${newMsgId.remote}_${newMsgId.id}`;
return newMsgId;
return new Store.MsgKey({
from: Store.UserPrefs.getMaybeMeUser(),
to: new Store.WidFactory.createWid(chatId),
id: Store.randomMessageId(),
participant: undefined,
selfDir: 'out',
});
}
4 changes: 4 additions & 0 deletions src/lib/wapi/store/store-objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,10 @@ export const storeObjects = [
? module.default
: null,
},
{
id: 'UserPrefs',
conditions: (module) => (module.getMaybeMeUser ? module : null),
},
{
id: 'randomMessageId',
conditions: (module) =>
Expand Down

0 comments on commit 0da9a62

Please sign in to comment.