Freescout: Delete all the threads from Deleted folder permanently

Created on 3 May 2019  路  7Comments  路  Source: freescout-helpdesk/freescout

I was always looking for a way to delete all the threads from Deleted folder permanently _(just like Empty Trash feature)_. There is _no native functionality at the moment_ to do so, so I've created this workaround.

Run the MySQL queries in the following order and it will get the job done.

(1) DELETE FROM threads WHERE conversation_id IN ( SELECT id FROM conversations WHERE folder_id = 6 AND mailbox_id = 1 AND user_id = 3 );

(2) DELETE FROM attachments WHERE thread_id NOT IN ( SELECT id FROM threads );

(3) DELETE FROM conversations WHERE folder_id = 6 AND mailbox_id = 1 AND user_id = 3;

(4) UPDATE folders SET total_count = 0, active_count = 0 WHERE id = 6 AND mailbox_id = 1 AND user_id = 3;

don't forget to update the mailbox_id and user_id values to it's respective one. You can find mailbox_id from within url by visiting Mailbox ( eg.: http://your-freescout-domain/mailbox/1. That means 1 is your mailbox_id ), and user_id by visiting user profile page ( eg.: http://your-freescout-domain/users/profile/3. That means 3 is your user_id ).

_Take a full backup of your database before you run the above queries._

I hope this will help someone looking to achieve the same. Appreciate if @freescout-helpdesk comment on the above.

ref: #213

help wanted

Most helpful comment

Yes. Eventually an "Empty Trash" button should be added to the Deleted folder.

All 7 comments

You also need to remove threads from threads table.

It would be indeed good to have "Delete selected"Delete all" buttons in Deleted folder. Records fromattachments` folder and attachments files also should be deleted.

Updated the query order which now delete the threads from threads table and delete the records from attachments table as well. Please review.

Beside the database records, a much bigger problems are the attachments in the storage directory.

Hi, is there any chance this could be added to Freescout as an admin option to remove deleted items?

Yes. Eventually an "Empty Trash" button should be added to the Deleted folder.

Thanks for the update, would be great to get this on the roadmap, due to the number of messages which are deleted.

I am noticing an issue with deleting permanently some drafts which keep reappearing. I thought they might be on the server but no. If there were a permadelete function it would make it easier to get rid of these persistent drafts.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

diguinho2018 picture diguinho2018  路  6Comments

iPublicis picture iPublicis  路  8Comments

psuet picture psuet  路  4Comments

nczz picture nczz  路  7Comments

Perflyst picture Perflyst  路  4Comments