diff --git a/src/Controllers/PostController.php b/src/Controllers/PostController.php index 17277043..bfadf93b 100644 --- a/src/Controllers/PostController.php +++ b/src/Controllers/PostController.php @@ -552,6 +552,8 @@ class PostController if (InputHelper::get('submit')) { //remove stuff from auxiliary tables + R::trashAll(R::find('postscore', 'post_id = ?', [$post->id])); + R::trashAll(R::find('crossref', 'post_id = ? OR post2_id = ?', [$post->id, $post->id])); foreach ($post->ownComment as $comment) { $comment->post = null; diff --git a/src/Controllers/UserController.php b/src/Controllers/UserController.php index 32914b11..1ab75592 100644 --- a/src/Controllers/UserController.php +++ b/src/Controllers/UserController.php @@ -253,6 +253,7 @@ class UserController if ($suppliedPasswordHash != $user->pass_hash) throw new SimpleException('Must supply valid password'); } + R::trashAll(R::find('postscore', 'user_id = ?', [$user->id])); foreach ($user->alias('commenter')->ownComment as $comment) { $comment->commenter = null;