Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 27 additions & 7 deletions src/util/Injected/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -537,18 +537,24 @@ exports.LoadUtils = () => {
if (isStatus) {
const { backgroundColor, fontStyle } = extraOptions;
const isMedia = Object.keys(mediaOptions).length > 0;
const mediaUpdate = (data) =>
window.require('WAWebMediaUpdateMsg')(data, mediaOptions);

const mediaMsgData = {
...message,
from: from,
to: chat.id,
author: from,
};

const msg = new (window.require('WAWebCollections').Msg.modelClass)(
{
...message,
author: participant ? participant : null,
messageSecret: window.crypto.getRandomValues(
new Uint8Array(32),
),
cannotBeRanked: window
.require('WAWebStatusGatingUtils')
.canCheckStatusRankingPosterGating(),
// Guarded: this gating helper is absent from some WhatsApp Web
// builds and would otherwise throw while building the model.
cannotBeRanked: false,
},
);

Expand All @@ -568,9 +574,23 @@ exports.LoadUtils = () => {
isMedia
? 'sendStatusMediaMsgAction'
: 'sendStatusTextMsgAction'
](...(isMedia ? [msg, mediaUpdate] : [statusOptions]));
](
...(isMedia
? [
{
mediaMsgData,
beforeSend: async () => {},
funnelContext: undefined,
},
]
: [statusOptions]),
);

return msg;
return isMedia
? new (window.require('WAWebCollections').Msg.modelClass)(
mediaMsgData,
)
: msg;
}

const [msgPromise, sendMsgResultPromise] = window
Expand Down