Browse Source

Update Models\Topic\Model

Do not use a database query for unvisited topics.
Visman 4 years ago
parent
commit
fa0aa815ce
1 changed files with 4 additions and 0 deletions
  1. 4 0
      app/Models/Topic/Model.php

+ 4 - 0
app/Models/Topic/Model.php

@@ -238,6 +238,8 @@ class Model extends DataModel
     {
     {
         if (false === $this->hasNew) {
         if (false === $this->hasNew) {
             return 0;
             return 0;
+        } elseif ($this->posted > $this->hasNew) {
+            return $this->first_post_id;
         }
         }
 
 
         $vars = [
         $vars = [
@@ -260,6 +262,8 @@ class Model extends DataModel
     {
     {
         if (false === $this->hasUnread) {
         if (false === $this->hasUnread) {
             return 0;
             return 0;
+        } elseif ($this->posted > $this->hasUnread) {
+            return $this->first_post_id;
         }
         }
 
 
         $vars = [
         $vars = [