Skip to content

Fix self message delete #3567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aleborile
Copy link

PR Details

Self Message delete fixed

Description

The self message sent in own chat cannot be deleted due to error

How Has This Been Tested

tested in shell:
$ const message = await client.sendMessage('[email protected]', 'todelete')
$ await message.delete()

Environment

Machine OS: Docker + Amazon Linux 2023
Phone OS: Android
Library Version: 1.27.0
WhatsApp Web Version: 2.3000.1022278655
Puppeteer Version: 18.2.1
Browser Type and Version: Chromium
Node Version: ^20

Types of changes

  • Dependency change
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • I have updated the documentation accordingly (index.d.ts).
  • I have updated the usage example accordingly (example.js)

@aleborile aleborile force-pushed the fix-self-message-delete branch from 25aa91c to 0c02220 Compare May 28, 2025 16:36
@tuyuribr tuyuribr added the AI PR Not necessary a bad pr, must review with extra caution label Jun 10, 2025
const canRevoke = window.Store.MsgActionChecks.canSenderRevokeMsg(msg) || window.Store.MsgActionChecks.canAdminRevokeMsg(msg);
const isSelfMsg = msg.from.user === msg.id.remote.user && msg.id.fromMe;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just msg.id.fromMe ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because msg.id.fromMe is true even if the chat is not of the current user, but a general message sent by current user.
First check detect the current user personal chat.

@aleborile
Copy link
Author

There still be a weird behaviour: message is deleted on any wweb session but not on phone (master) session. Maybe someone who knows wweb core better can help on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AI PR Not necessary a bad pr, must review with extra caution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants