Skip to content

feat: add forMe query param to DELETE /messages for local-only deletion#2023

Open
zaghloul404 wants to merge 1 commit intodevlikeapro:corefrom
zaghloul404:core
Open

feat: add forMe query param to DELETE /messages for local-only deletion#2023
zaghloul404 wants to merge 1 commit intodevlikeapro:corefrom
zaghloul404:core

Conversation

@zaghloul404
Copy link
Copy Markdown

Closes #2022

Summary

Adds a forMe boolean query parameter to DELETE /api/{session}/chats/{chatId}/messages/{messageId}.

When forMe=true, the WEBJS engine calls message.delete(false) instead of message.delete(true), triggering a local-only deletion (sendDeleteMsgs) instead of a revoke (sendRevokeMsgs). This enables true "delete for me" behavior for sent messages.

Changes

  • src/structures/chats.dto.ts — New DeleteMessageQuery class
  • src/api/chats.controller.ts — Accept @Query() and pass forMe to session
  • src/core/abc/session.abc.ts — Updated abstract signature
  • src/core/engines/webjs/session.webjs.core.tsmessage.delete(!forMe) (the actual fix)
  • src/core/engines/noweb/session.noweb.core.ts — Signature update
  • src/core/engines/gows/session.gows.core.ts — Signature update

Backward Compatible

  • Default value: forMe = false
  • Without the parameter, behavior is identical to current code
  • No breaking changes to existing API consumers

Tested

  • WEBJS engine, Docker on macOS ARM64
  • Confirmed local-only deletion for both sent and received messages with forMe=true
  • Confirmed existing revoke behavior preserved without the parameter

Adds a `forMe` boolean query parameter to the delete message API.
When forMe=true, WEBJS calls message.delete(false) for local-only
deletion instead of message.delete(true) which revokes for everyone.

This enables "delete for me" on sent messages without leaving a
"You deleted this message" trace on the recipient's phone.

Made-with: Cursor
@devlikepro
Copy link
Copy Markdown
Contributor

Let's see how many patron:PLUS and patron:PRO supporters needs the feature and prioritize it based on that.

Comment with "+1" if you need it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add forMe parameter to DELETE /messages endpoint for local-only deletion

2 participants