From a9b3b28d001941921aa70d37fdc87c758a163a44 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Fri, 05 Jun 2026 16:47:03 +0000
Subject: [PATCH] =Some hefty changes to FeedBlock. Transitioning to loading first page in php to save on extra requests. Got a bit to do yet, but I have to work on Northeh for a bit here.

---
 inc/rest/routes/FavouritesRoutes.php |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/inc/rest/routes/FavouritesRoutes.php b/inc/rest/routes/FavouritesRoutes.php
index 9690a53..32d7866 100644
--- a/inc/rest/routes/FavouritesRoutes.php
+++ b/inc/rest/routes/FavouritesRoutes.php
@@ -3,6 +3,7 @@
 
 use JVBase\managers\Cache;
 use JVBase\managers\CustomTable;
+use JVBase\registrar\Registrar;
 use JVBase\rest\PermissionHandler;
 use JVBase\rest\Response;
 use JVBase\rest\Rest;
@@ -36,12 +37,12 @@
 		parent::__construct();
 
 		// Set up cache connections
-		$this->cache->connect('post')->connect('user')->connect('taxonomy');
-		$this->listsCache = Cache::for('lists')->connect('favourites', true);
-		$this->sharedListsCache = Cache::for('sharedLists')->connect('favourites', true);
-		$this->favouritesCache = Cache::for('allFavourites')->connect('favourites', true);
+		$this->cache->connect('post')->connect('user')->connect('taxonomy')->user();
+		$this->listsCache = Cache::for('lists')->connect('favourites', true)->user();
+		$this->sharedListsCache = Cache::for('sharedLists')->connect('favourites', true)->user();
+		$this->favouritesCache = Cache::for('allFavourites')->connect('favourites', true)->user();
 
-		$this->valid_types = array_keys(array_merge(JVB_CONTENT, JVB_TAXONOMY));
+		$this->valid_types = array_merge(Registrar::getRegistered('post'), Registrar::getRegistered('term'));
 
 		// Initialize CustomTable instances
 		$this->favourites = CustomTable::for('favourites');
@@ -504,7 +505,7 @@
 			'target_id' => $target_id
 		]);
 
-		if ($result['created']) {
+		if ((bool)$result) {
 			$this->updateFavouriteCount($type, $target_id);
 			$this->maybeNotifyOwner($type, $target_id, $user_id);
 		}
@@ -581,13 +582,13 @@
 							'type' => $type,
 							'target_id' => $target_id
 						]);
-						if ($result['created']) $results['added']++;
+						if ((bool) $result) $results['added']++;
 					} else {
-						$deleted = $table->where([
+						$deleted = $table->delete([
 							'user_id' => $user_id,
 							'type' => $type,
 							'target_id' => $target_id
-						])->deleteResults();
+						]);
 						if ($deleted) $results['removed']++;
 					}
 
@@ -847,7 +848,7 @@
 
 		$args = array_merge($args, [
 			'page' => max(1, absint($data['page'] ?? 1)),
-			'content' => $this->checkContent($data['content'] ?? 'all')
+			'content' => Registrar::getInstance($data['content']) ? $data['content'] : 'all',
 		]);
 
 		return $this->applyOrderFilters($args, $data);

--
Gitblit v1.10.0