diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2024-04-30 12:09:43 +0000 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2024-04-30 12:09:43 +0000 |
| commit | 118d31c8878b5918fddd913069e57077c4aa46f2 (patch) | |
| tree | 39f6c820d6ab9e68505d5caa7e4a701c0cf0a924 /lib | |
| parent | 4711c82b887a0629acf53352981f3badbbce8ba7 (diff) | |
cleanup blubber and delete correctly, fixes #4097
Closes #4097
Merge request studip/studip!2943
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/classes/UserManagement.class.php | 12 | ||||
| -rw-r--r-- | lib/models/User.class.php | 17 |
2 files changed, 17 insertions, 12 deletions
diff --git a/lib/classes/UserManagement.class.php b/lib/classes/UserManagement.class.php index c831b85..e3d9aa3 100644 --- a/lib/classes/UserManagement.class.php +++ b/lib/classes/UserManagement.class.php @@ -1122,18 +1122,6 @@ class UserManagement // delete the datafields $localEntries = DataFieldEntry::removeAll($user_id); - // delete all blubber entrys - $query = "DELETE blubber_threads, blubber_mentions, blubber_comments - FROM blubber_threads - LEFT JOIN blubber_mentions USING (user_id) - LEFT JOIN blubber_comments USING (user_id) - WHERE user_id = ?"; - $statement = DBManager::get()->prepare($query); - $statement->execute([$user_id]); - if ($count = $statement->rowCount()) { - $msg .= 'info§' . sprintf(_('%s Blubber gelöscht.'), $count) . '§'; - } - // delete user from waiting lists $query = "SELECT seminar_id FROM admission_seminar_user WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); diff --git a/lib/models/User.class.php b/lib/models/User.class.php index 056b48a..ab92bad 100644 --- a/lib/models/User.class.php +++ b/lib/models/User.class.php @@ -52,6 +52,9 @@ * @property SimpleORMapCollection|Kategorie[] $profile_categories has_many Kategorie * @property SimpleORMapCollection|MvvContact[] $mvv_assignments has_many MvvContact * @property SimpleORMapCollection|CourseMemberNotification[] $course_notifications has_many CourseMemberNotification + * @property SimpleORMapCollection|BlubberThread[] $blubber_threads has_many BlubberThread + * @property SimpleORMapCollection|BlubberComment[] $blubber_comments has_many BlubberComment + * @property SimpleORMapCollection|BlubberMention[] $blubber_mentions has_many BlubberMention * @property UserInfo $info has_one UserInfo * @property UserOnline $online has_one UserOnline * @property Courseware\Unit $courseware_units has_one Courseware\Unit @@ -206,6 +209,20 @@ class User extends AuthUserMd5 implements Range, PrivacyObject, Studip\Calendar\ 'assoc_foreign_key' => 'author_id' ]; + // Blubber relations + $config['has_many']['blubber_threads'] = [ + 'class_name' => BlubberThread::class, + 'on_delete' => 'delete', + ]; + $config['has_many']['blubber_comments'] = [ + 'class_name' => BlubberComment::class, + 'on_delete' => 'delete', + ]; + $config['has_many']['blubber_mentions'] = [ + 'class_name' => BlubberMention::class, + 'on_delete' => 'delete', + ]; + $config['additional_fields']['config']['get'] = function ($user) { return UserConfig::get($user->id); }; |
