- Issue created by @idimopoulos
- Merge request !145Thread deletion might leave leftover messages. β (Merged) created by idimopoulos
- π§πͺBelgium herved
I tested the above scenarios, works correctly. Just a minor nit.
+1, looks like a good fix and maintains BC. - π·π΄Romania claudiu.cristea Arad π·π΄
Needs an upgrade path to ensure we're also cleaning potential orphan private messages and orphan entries in pm_thread_history table
- π¬π·Greece idimopoulos
I have added a post update hook to clean the orphaned messages.
2 notes:
1) I used the Drupal API because the private message entity is fieldable. We cannot simply remove the lines from the main table.
2) I haven't provided a test for this. I used the ddev method to setup the project, installed it, used the following script to just create messages<?php use Drupal\Component\Utility\Random; $random = new Random(); for ($i = 0; $i < 1000; $i++) { $message = \Drupal::entityTypeManager() ->getStorage('private_message') ->create([ 'owner' => 0, 'message' => $random->name(), ]); $message->save(); }
and just ran the deploy hook to ensure everything is removed. Cheers
- π·π΄Romania claudiu.cristea Arad π·π΄
Upgrade path added. This looks good. It has testing coverage and I've tested manually the update path. Approved!
-
claudiu.cristea β
committed 4d338419 on 4.x authored by
idimopoulos β
Issue #3488508 by idimopoulos, claudiu.cristea, herved: Thread deletion...
-
claudiu.cristea β
committed 4d338419 on 4.x authored by
idimopoulos β
-
claudiu.cristea β
committed 4ea3033d on 3.0.x authored by
idimopoulos β
Issue #3488508 by idimopoulos, claudiu.cristea, herved: Thread deletion...
-
claudiu.cristea β
committed 4ea3033d on 3.0.x authored by
idimopoulos β
- π·π΄Romania claudiu.cristea Arad π·π΄
Merged into 4.x & 3.0.x. Thank you all
- πΊπΈUnited States SocialNicheGuru
if you have no messages this breaks your site:
$sandbox['#finished'] = $sandbox['current_id'] / $sandbox['total'];
DivisionByZeroError: Division by zero in /drupal-10.3.x/html/modules/contrib/private_message/private_message.post_update.php on line 43
Automatically closed - issue fixed for 2 weeks with no activity.