Skip to content

fix(imp): refresh search list after trash delete#92

Merged
TDannhauer merged 1 commit into
FRAMEWORK_6_0from
fix/search-delete-trash-ui
Jul 17, 2026
Merged

fix(imp): refresh search list after trash delete#92
TDannhauer merged 1 commit into
FRAMEWORK_6_0from
fix/search-delete-trash-ui

Conversation

@TDannhauer

Copy link
Copy Markdown
Contributor

Summary

  • Fix search-result delete so messages are moved to Trash (or leave the list) instead of sticking with an optimistic IMAP \Deleted mark when use_trash is enabled.
  • Always refresh the search viewport after delete so synthetic BUIDs and rebuilt result sets stay in sync.
  • If move-to-trash cannot run because the mailbox lacks expunge rights, fall back to mark-as-deleted instead of doing nothing.

Motivation

Deleting multiple messages from IMP search results painted them as deleted but left them in place, while the same action from a normal mailbox correctly honored the Trash preference.

Changes

  • js/base.js: skip optimistic \Deleted when viewport metadata nodeleteshow is set (Trash mode).
  • lib/Ajax/Application.php: force a full viewport refresh after delete in search mailboxes.
  • lib/Indices.php: treat failed move-to-trash (no expunge ACL) as mark-as-deleted rather than a silent no-op.

Test plan

  • Enable move-to-Trash in IMP prefs (real Trash folder).
  • Search for messages, multi-select results, click Delete.
  • Confirm messages leave the search list and appear in Trash.
  • Confirm delete from a normal mailbox still moves to Trash.
  • Hard-refresh the browser so updated js/base.js is loaded.

When use_trash is enabled, do not paint an optimistic \Deleted flag on
delete. Force a search viewport refresh after deletion so moved messages
leave the result list. If move-to-trash cannot run (no expunge rights),
fall back to mark-as-deleted instead of a silent no-op.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes inconsistent delete behavior for messages deleted from search results by ensuring Trash-mode deletes behave like normal mailbox deletes (move to Trash / disappear), and by forcing a viewport refresh so session-synthetic search BUIDs don’t leave stale rows behind.

Changes:

  • Skip the client-side optimistic \Deleted paint when the viewport is in “Trash mode” (nodeleteshow), relying on server/viewport updates instead.
  • Always trigger a full viewport refresh after deletions in search mailboxes so rebuilt result sets and synthetic BUIDs stay consistent.
  • When move-to-Trash can’t be attempted due to missing expunge rights, fall back to marking messages as \Deleted (instead of doing nothing).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
lib/Indices.php Makes Trash move conditional on expunge rights and ensures non-move cases still perform mark-as-deleted cleanup.
lib/Ajax/Application.php Forces full viewport refresh after deletes when the active mailbox is a search mailbox.
js/base.js Avoids optimistic \Deleted flag painting when nodeleteshow indicates Trash-mode UI behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@TDannhauer
TDannhauer merged commit 5645001 into FRAMEWORK_6_0 Jul 17, 2026
1 of 2 checks 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.

2 participants