Skip to content

Commit

Permalink
fix: Fixed buttons/list reply is not flagging chat as unread (fix #768)
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Dec 1, 2022
1 parent 864d060 commit 3c3cd94
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/chat/patch.ts
Expand Up @@ -17,6 +17,7 @@
import * as webpack from '../webpack';
import { wrapModuleFunction } from '../whatsapp/exportModule';
import {
isUnreadTypeMsg,
mediaTypeFromProtobuf,
typeAttributeFromProtobuf,
} from '../whatsapp/functions';
Expand Down Expand Up @@ -63,6 +64,23 @@ function applyPatch() {

return func(...args);
});

/**
* Reinforce unread messages for buttons and lists
*/
wrapModuleFunction(isUnreadTypeMsg, (func, ...args) => {
const [msg] = args;

switch (msg.type) {
case 'buttons_response':
case 'list':
case 'list_response':
case 'template_button_reply':
return true;
}

return func(...args);
});
}

/**
Expand Down

0 comments on commit 3c3cd94

Please sign in to comment.