Browse Source

Use the current Forums manager in the Forum model

Before this commit, the container->forums manager was used, which caused a logical error when deleting messages if there were hidden forums.
Visman 1 year ago
parent
commit
46714487d4
2 changed files with 5 additions and 5 deletions
  1. 4 4
      app/Models/Forum/Forum.php
  2. 1 1
      app/Models/Forum/Forums.php

+ 4 - 4
app/Models/Forum/Forum.php

@@ -35,7 +35,7 @@ class Forum extends DataModel
 
             return null;
         } else {
-            return $this->c->forums->get($this->parent_forum_id);
+            return $this->manager->get($this->parent_forum_id);
         }
     }
 
@@ -101,7 +101,7 @@ class Forum extends DataModel
 
         if (\is_array($attr)) {
             foreach ($attr as $id) {
-                $sub[$id] = $this->c->forums->get($id);
+                $sub[$id] = $this->manager->get($id);
             }
         }
 
@@ -118,7 +118,7 @@ class Forum extends DataModel
 
         if (\is_array($attr)) {
             foreach ($attr as $id) {
-                $all[$id] = $this->c->forums->get($id);
+                $all[$id] = $this->manager->get($id);
             }
         }
 
@@ -360,7 +360,7 @@ class Forum extends DataModel
                 }
             }
 
-            $attr = $this->c->forums->create([
+            $attr = $this->manager->create([
                 'num_topics'   => $numT,
                 'num_posts'    => $numP,
                 'last_post'    => $time,

+ 1 - 1
app/Models/Forum/Forums.php

@@ -34,7 +34,7 @@ class Forums extends Manager
      */
     public function create(array $attrs = []): Forum
     {
-        return $this->c->ForumModel->setModelAttrs($attrs);
+        return $this->c->ForumModel->setManager($this)->setModelAttrs($attrs);
     }
 
     /**