浏览代码

Update Models\Topic\Model

Do not use a database query for unvisited topics.
Visman 4 年之前
父节点
当前提交
fa0aa815ce
共有 1 个文件被更改,包括 4 次插入0 次删除
  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) {
             return 0;
+        } elseif ($this->posted > $this->hasNew) {
+            return $this->first_post_id;
         }
 
         $vars = [
@@ -260,6 +262,8 @@ class Model extends DataModel
     {
         if (false === $this->hasUnread) {
             return 0;
+        } elseif ($this->posted > $this->hasUnread) {
+            return $this->first_post_id;
         }
 
         $vars = [