Skip to content

feat: show last message for ghost group (WPB-25285) - #4356

Open
sbakhtiarov wants to merge 1 commit into
feat/adminless-eventsfrom
feat/ghost-group-message
Open

feat: show last message for ghost group (WPB-25285)#4356
sbakhtiarov wants to merge 1 commit into
feat/adminless-eventsfrom
feat/ghost-group-message

Conversation

@sbakhtiarov

@sbakhtiarov sbakhtiarov commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

https://wearezeta.atlassian.net/browse/WPB-25285

What's new in this PR?

Issues

When a group loses all eligible admins, the backend sends an "adminless delete reminder" system event announcing that the group will be automatically deleted.
Until now this reminder was persisted but treated as Unknown for preview purposes, so the conversation list showed a stale/blank last message for these "ghost" groups instead of surfacing the pending-deletion state.

Causes

  • ADMINLESS_DELETE_REMINDER mapped to MessagePreviewEntityContent.Unknown,
    so it never produced a meaningful preview.
  • The conversation-list use cases had no notion of the reminder, so a group's
    real last message (or an empty draft) was shown regardless of the pending
    deletion.
  • clearContent deleted every message in a conversation, which would also wipe
    the reminder and lose the ghost-group state on clear.

Solutions

  • Added a dedicated preview content type end-to-end:
    MessagePreviewEntityContent.AdminlessDeleteReminder (persistence) →
    MessagePreviewContent.AdminlessDeleteReminder (domain), wired through
    MessageMapper.
  • Added getAdminlessDeleteReminderPreviews (SQLDelight) +
    MessageDAO.observeAdminlessDeleteReminderPreviews(), returning the newest
    ADMINLESS_DELETE_REMINDER per conversation (VISIBLE/DELETED), exposed via
    ConversationRepository.observeAdminlessDeleteReminderPreviews().
  • In ObserveConversationListDetailsWithEventsUseCaseImpl and
    GetPaginatedFlowOfConversationDetailsWithEventsBySearchQueryUseCase, the
    reminder now overrides lastMessage for its conversation (non-archive only),
    while preserving unread-event counts and ordering.
  • clearContent now preserves ADMINLESS_DELETE_REMINDER rows
    (AND content_type != 'ADMINLESS_DELETE_REMINDER') so clearing a ghost group
    keeps the pending-deletion indicator.

Dependencies

Needs releases with:

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Test Results

0 tests  ±0   0 ✅ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
0 files   ±0   0 ❌ ±0 

Results for commit 8427330. ± Comparison against base commit 7056798.

♻️ This comment has been updated with latest results.

Comment on lines +559 to +561
DELETE FROM Message
WHERE conversation_id = :conversationId
AND content_type != 'ADMINLESS_DELETE_REMINDER';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

at this point does the ADMINLESS_DELETE_REMINDER need to be a reminder vs a flag in the conv table (wll_be_deleted_at) this way it pinned to the bottom, and does not effect messages or wdyt ?

Comment on lines +69 to +74
conversations.combine(conversationRepository.observeAdminlessDeleteReminderPreviews()) { pagingData, reminders ->
if (reminders.isEmpty()) {
pagingData
} else {
val remindersByConversationId = reminders.associateBy { it.conversationId }
pagingData.map { conversation ->

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i am not sure why do we need to observe these separately vs folding this data with the preview

@MohamadJaara MohamadJaara left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

few things need to be cleared before merging. mainly why making this as a message and observing it separately in the use case complicating the flow, when we can make it a column in the conv that X conversaion will be deleted

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.

2 participants