Skip to content

fix(msg): Report the count Telegram actually deleted, not requested#29

Merged
cuiko merged 2 commits into
vika2603:mainfrom
cuiko:fix/msg-delete-affected-count
Jun 4, 2026
Merged

fix(msg): Report the count Telegram actually deleted, not requested#29
cuiko merged 2 commits into
vika2603:mainfrom
cuiko:fix/msg-delete-affected-count

Conversation

@cuiko

@cuiko cuiko commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • msg delete printed deleted N message(s) with N = the number of IDs requested, even when the server affected fewer. Deleting another user's message self-side in a supergroup is a no-op, yet it still reported success for every ID.
  • Thread the RPC's affected count (PtsCount) through DeleteMessagesDeleteFuncDeleteResult, so the output reflects what Telegram actually removed.
  • The daemon's msg.delete handler now returns the count instead of a bare true. The client decodes it and — against an older daemon that still answers true — falls back to the requested count so delete keeps working across a version skew.

Test plan

  • go build ./..., go vet, golangci-lint run, go test ./...
  • Unit: action/CLI tests assert the printed count comes from the affected value (request 2, server reports 1 → deleted 1), not len(ids).
  • Live (local path): deleting a real own message → deleted 1; deleting a non-existent id → deleted 0 (previously 1).
  • Live (skew): new CLI against the old running daemon (returns true) → delete still succeeds via the requested-count fallback (no unmarshal error).

cuiko added 2 commits June 4, 2026 18:32
`msg delete` printed "deleted N message(s)" with N = the number of IDs
requested, even when the server affected fewer. Deleting another user's
message self-side in a supergroup is a no-op, yet it still reported success
for every ID. Thread the RPC's affected count (PtsCount) through
DeleteMessages -> DeleteFunc -> DeleteResult so the output reflects what
Telegram actually removed.

The daemon's msg.delete handler now returns the count instead of a bare
"true"; the client decodes it and, against an older daemon that still
answers "true", falls back to the requested count so delete keeps working
across a version skew.
Pull the daemon msg.delete response decoding into decodeDeleteCount so the
old-daemon fallback (a bare "true" ack -> requested count) is unit-tested
rather than only exercised through the production closure.
@cuiko
cuiko merged commit 2a18669 into vika2603:main Jun 4, 2026
1 check passed
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.

1 participant