Skip to content

Open the next active conversation after deleting, per the after-send setting - #5693

Merged
freescout-help-desk merged 1 commit into
freescout-help-desk:masterfrom
JayOfTheKeyboard:feature/delete-open-next
Oct 2, 2026
Merged

freescout-help-desk merged 1 commit into
freescout-help-desk:masterfrom
JayOfTheKeyboard:feature/delete-open-next

Conversation

@JayOfTheKeyboard

Copy link
Copy Markdown
Contributor

Follow-up to #5683.

Problem

After deleting a conversation, FreeScout always returns to the folder list. Working through a backlog of emails means deleting one, then picking the next one from the list, every time.

The "after send" setting already covers this for other actions. Its help text says:

This setting gives you control over what page loads after you perform an action (send a reply, add a note, change conversation status or assignee).

So with "Next active conversation" selected, changing the status opens the next conversation, but deleting does not. Delete is currently the one action that ignores the setting.

Fix

delete_conversation and delete_conversation_forever get their redirect from a new getRedirectUrlAfterDelete():

public function getRedirectUrlAfterDelete($conversation, $user)
{
    if ($conversation->mailbox->getUserSettings($user->id)->after_send == MailboxUser::AFTER_SEND_NEXT) {
        return $conversation->urlNext(Conversation::getFolderParam(), Conversation::STATUS_ACTIVE, true);
    }

    return route('mailboxes.view.folder', ['id' => $conversation->mailbox_id, 'folder_id' => $conversation->getCurrentFolder()]);
}

It uses the same urlNext(..., STATUS_ACTIVE, true) call as getRedirectUrl(), so "next" means the same as after a status change: the next active conversation in the folder being viewed, or the previous one if it was the last, or the folder if none is left.

It is called before the delete. After deleteToFolder() the conversation is in Deleted, and "next" would be worked out from the wrong folder.

"After send" setting After delete, before After delete, after
Next active conversation folder next active conversation
Back to folder folder folder
Stay on the same page folder folder

Not changed

  • "Next active conversation" is the default for after_send (the mailbox_user migration), so this changes what most users see after a delete. That seemed right, since it is what the setting describes, but I wanted to say it plainly.
  • "Stay on the same page" still returns to the folder, since the conversation just deleted is no longer in it.
  • No new setting and no new strings.

Tested

On master at 2f1739e, with "Next active conversation" set, deleting from Unassigned opened the next conversation (/conversation/<next>?folder_id=1). Without this change the same steps land on /mailbox/1/1. Both delete and delete forever go through the same method.

Files

  • app/Http/Controllers/ConversationsController.php: delete_conversation, delete_conversation_forever, new getRedirectUrlAfterDelete()

…setting

After deleting a conversation FreeScout always returns to the folder. When the user's after-send setting is "Next active conversation", open the next active conversation instead, as changing the status already does. Other settings keep returning to the folder. The next conversation is found before the delete, while the conversation is still in its folder.
@freescout-help-desk
freescout-help-desk merged commit f594564 into freescout-help-desk:master Oct 2, 2026
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