feat: add message deletion#557
Merged
torlando-tech merged 4 commits intotorlando-tech:mainfrom Feb 27, 2026
Merged
Conversation
Contributor
Greptile SummaryThis PR implements local message deletion with proper handling of orphaned reply previews. The implementation follows a clean architecture pattern from UI → ViewModel → Repository → DAO. Key changes:
Observations:
Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User long-presses message] --> B[MessageActionButtons displayed]
B --> C[User taps Delete button]
C --> D[Delete confirmation dialog shown]
D --> E{User confirms?}
E -->|Cancel| F[Dialog dismissed, return to chat]
E -->|Delete| G[ViewModel.deleteMessage called]
G --> H[ConversationRepository.deleteMessage]
H --> I[Delete message from DB]
I --> J[Get new last message]
J --> K{Messages remain?}
K -->|Yes| L[Update conversation lastMessage/timestamp]
K -->|No| M[Clear conversation lastMessage/timestamp]
L --> N[ViewModel updates reply preview cache]
M --> N
N --> O{Reply previews reference deleted message?}
O -->|Yes| P[Replace with 'Message deleted' placeholder]
O -->|No| Q[Cache unchanged]
P --> R[UI updates, orphaned replies show placeholder]
Q --> R
R --> S[User taps orphaned reply preview]
S --> T{Message exists in messagePositions?}
T -->|No| U[No-op, no scroll]
T -->|Yes| V[Scroll to message]
Last reviewed commit: 1fabe9f |
Contributor
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
- Add deleteMessage() to ConversationRepository with conversation lastMessage update after deletion - Add deleteMessage() to MessagingViewModel - Add onDelete callback to ReactionModeOverlay and MessageActionButtons - Wire delete action with confirmation dialog in MessagingScreen - Add unit tests for deleteMessage in MessagingViewModelTest
- Invalidate reply preview cache entries referencing deleted messages, replacing them with a "Message deleted" placeholder - Hide empty sender name in ReplyPreviewBubble for deleted message placeholders (avoids blank line in the UI)
- deleteMessage test now asserts reply preview cache invalidation - no-conversation test asserts state is unchanged - Fixes detekt NoVerifyOnlyTests rule violations
… dialog The delete button was calling handleDismiss() which started the overlay exit animation (~3s), causing the confirmation dialog to auto-dismiss when the animation completed. Now the dialog stays in the overlay (same pattern as the full emoji picker) and exitReactionMode() is called only after the user confirms or cancels.
1fabe9f to
cb56628
Compare
torlando-tech
approved these changes
Feb 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add the ability to delete individual messages from conversations.
Changes
Data layer (
ConversationRepository)deleteMessage(messageId, conversationHash)— deletes the message and updates the conversation'slastMessage/lastMessageTimestampto reflect the new most recent message (or clears them if no messages remain)ViewModel (
MessagingViewModel)deleteMessage(messageId)— orchestrates deletion and invalidates cached reply previews that reference the deleted message, replacing them with a "Message deleted" placeholderUI
MessageActionButtonsin the long-press overlayReplyPreviewBubblehides empty sender name for deleted message placeholdersBehavior
Tests
deleteMessage invalidates reply preview cache for deleted messagedeleteMessage without active conversation does not modify state