Fix deletion of orphaned activity events
authorMatthias Schmidt <gravatronics@live.com>
Wed, 21 Jan 2015 20:48:01 +0000 (21:48 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Wed, 21 Jan 2015 20:48:01 +0000 (21:48 +0100)
Initially, an activity event is neither accessible nor orphaned. If an orphaned activity event is detected, it is simply set as orphaned but internally it is also still marked as not accessible. Therefore, we need to first check if an event is an orphan and only afterwards if it is accessible (an accessible, but orphaned event makes no sense).

wcfsetup/install/files/lib/data/user/activity/event/ViewableUserActivityEventList.class.php

index 886a2286ca29ab14842d3b7d2d26148aa5037ae6..bce139c1cdfad807277e9b5f18fb7ccea6f5143d 100644 (file)
@@ -110,11 +110,11 @@ class ViewableUserActivityEventList extends UserActivityEventList {
                $orphanedEventIDs = array();
                
                foreach ($this->objects as $index => $event) {
-                       if (!$event->isAccessible()) {
+                       if ($event->isOrphaned()) {
+                               $orphanedEventIDs[] = $event->eventID;
                                unset($this->objects[$index]);
                        }
-                       else if ($event->isOrphaned()) {
-                               $orphanedEventIDs[] = $event->eventID;
+                       else if (!$event->isAccessible()) {
                                unset($this->objects[$index]);
                        }
                }