Mark contents created before user registration as read
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 12 Feb 2021 10:50:14 +0000 (11:50 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 12 Feb 2021 11:10:12 +0000 (12:10 +0100)
Resolves #3971

wcfsetup/install/files/lib/system/visitTracker/VisitTracker.class.php

index 12a9483a8527fea58a722eaf9436cf3beeb86565..744e08bcee62ff37fb660dbbced6a14cd6a1606b 100644 (file)
@@ -106,6 +106,11 @@ class VisitTracker extends SingletonFactory
         $lifetime = ($this->availableObjectTypes[$objectType]->lifetime) ?: self::DEFAULT_LIFETIME;
         $minimum = TIME_NOW - $lifetime;
 
+        if (WCF::getUser()->userID) {
+            // Mark everything before the registration date as read.
+            $minimum = \max($minimum, WCF::getUser()->registrationDate);
+        }
+
         if (isset($this->userVisits[$objectTypeID])) {
             // double times the lifetime period for existing visit data;
             // equals 2 weeks for the default lifetime of 7 days