From c204185ae86a98994f80010abf35a190c9406739 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 12 Jul 2026 18:08:19 +0000
Subject: [PATCH] =Refactor of Integrations.php. Separated different functionality into traits that classes can use to add that functionality. Hopefully will make maintaining it a little easier. Still have to finish up, as well as refactoring the individual classes to utilize the new system.

---
 inc/rest/routes/FeedRoutes.php |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/inc/rest/routes/FeedRoutes.php b/inc/rest/routes/FeedRoutes.php
index f4e0ab1..814b821 100644
--- a/inc/rest/routes/FeedRoutes.php
+++ b/inc/rest/routes/FeedRoutes.php
@@ -1,17 +1,17 @@
 <?php
 namespace JVBase\rest\routes;
 
+use JVBase\base\Site;
 use JVBase\meta\Meta;
 use JVBase\registrar\Registrar;
 use JVBase\rest\Rest;
-use JVBase\integrations\Umami;
 use JVBase\rest\Route;
-use JVBase\base\Site;
-use WP_Query;
+use Umami;
 use WP_Post;
-use WP_Term;
+use WP_Query;
 use WP_REST_Request;
 use WP_REST_Response;
+use WP_Term;
 
 if (!defined('ABSPATH')) {
     exit; // Exit if accessed directly
@@ -70,7 +70,6 @@
 				'context' => 'string',
 				'contextId' => 'string',
 				'favourites' => 'boolean',
-				'user' => 'integer',
 				'highlight' => 'string',
 			])
 			->auth('public')
@@ -89,7 +88,6 @@
 				'context' => 'string',
 				'contextId' => 'string',
 				'favourites' => 'boolean',
-				'user' => 'integer',
 				'highlight' => 'string',
 			])
 			->auth('public')
@@ -543,11 +541,15 @@
 	 */
 	protected function applyFavouritesFilter(array $args, array $data): array
 	{
-		if (empty($data['favourites']) || empty($data['user'])) {
+		if (empty($data['favourites'])) {
 			return $args;
 		}
 
-		$user_id = (int)$data['user'];
+		$user_id = get_current_user_id();
+		if (!$user_id) {
+			//Shouldn't happen, but whatever
+			return $args;
+		}
 		$content = jvbNoBase($args['post_type']);
 
 		// Get user's favourites for this content type

--
Gitblit v1.10.0