fix: message_edit event and edit caption in file (#2617)
* edit caption * Update Client.js * refactor: events combined into one line --------- Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
This commit is contained in:
parent
4009bb792b
commit
3dab4a3f41
2 changed files with 3 additions and 2 deletions
|
|
@ -43,6 +43,7 @@ const NoAuth = require('./authStrategies/NoAuth');
|
|||
* @fires Client#message_create
|
||||
* @fires Client#message_revoke_me
|
||||
* @fires Client#message_revoke_everyone
|
||||
* @fires Client#message_edit
|
||||
* @fires Client#media_uploaded
|
||||
* @fires Client#group_join
|
||||
* @fires Client#group_leave
|
||||
|
|
@ -665,7 +666,7 @@ class Client extends EventEmitter {
|
|||
window.Store.Msg.on('change:ack', (msg, ack) => { window.onMessageAckEvent(window.WWebJS.getMessageModel(msg), ack); });
|
||||
window.Store.Msg.on('change:isUnsentMedia', (msg, unsent) => { if (msg.id.fromMe && !unsent) window.onMessageMediaUploadedEvent(window.WWebJS.getMessageModel(msg)); });
|
||||
window.Store.Msg.on('remove', (msg) => { if (msg.isNewMsg) window.onRemoveMessageEvent(window.WWebJS.getMessageModel(msg)); });
|
||||
window.Store.Msg.on('change:body', (msg, newBody, prevBody) => { window.onEditMessageEvent(window.WWebJS.getMessageModel(msg), newBody, prevBody); });
|
||||
window.Store.Msg.on('change:body change:caption', (msg, newBody, prevBody) => { window.onEditMessageEvent(window.WWebJS.getMessageModel(msg), newBody, prevBody); });
|
||||
window.Store.AppState.on('change:state', (_AppState, state) => { window.onAppStateChangedEvent(state); });
|
||||
window.Store.Conn.on('change:battery', (state) => { window.onBatteryStateChangedEvent(state); });
|
||||
window.Store.Call.on('add', (call) => { window.onIncomingCall(call); });
|
||||
|
|
|
|||
|
|
@ -644,7 +644,7 @@ class Message extends Base {
|
|||
let msg = window.Store.Msg.get(msgId);
|
||||
if (!msg) return null;
|
||||
|
||||
let catEdit = (msg.type === 'chat' && window.Store.MsgActionChecks.canEditText(msg));
|
||||
let catEdit = window.Store.MsgActionChecks.canEditText(msg) || window.Store.MsgActionChecks.canEditCaption(msg);
|
||||
if (catEdit) {
|
||||
const msgEdit = await window.WWebJS.editMessage(msg, message, options);
|
||||
return msgEdit.serialize();
|
||||
|
|
|
|||
Loading…
Reference in a new issue