From b38f03c0e7218762d90fa5092696b127f24f36db Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 25 Jan 2026 07:07:26 +0000
Subject: [PATCH] =Some logical flaws in Queue.php, Queue.js, ContentExecutor.php, UploadExecutor.php - particularly with timeline ordering, frontend queue updates, etc

---
 inc/rest/routes/NotificationsRoutes.php |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/inc/rest/routes/NotificationsRoutes.php b/inc/rest/routes/NotificationsRoutes.php
index eb39e8b..0ac3889 100644
--- a/inc/rest/routes/NotificationsRoutes.php
+++ b/inc/rest/routes/NotificationsRoutes.php
@@ -386,22 +386,24 @@
 			]);
 		}
 
+
+		$params = $this->getSanitizedData($user_id, $data);
+		$params['user'] = $user_id;
+		$key = $this->cache->generateKey($params);
 		// Check HTTP cache headers (includes notification types in timestamp check)
-		$cache_check = $this->checkUserHeaders($request, $user_id, 'notifications');
+		$cache_check = $this->checkHeaders($request, $key);
 		if ($cache_check) {
 			return $cache_check;
 		}
 
         // Step 1: Build status/order/filter params
-        $params = $this->getSanitizedData($user_id, $data);
         $status = $params['status'];
         $limit = $params['limit'];
         $offset = $params['page'];
         $type = $params['type'];
 
         // Try cache first with validated parameters
-        $cache_key = "user_{$user_id}_merged_notifications_{$status}_{$type}_{$limit}_{$offset}";
-        $cached = $this->cache->get($cache_key);
+        $cached = $this->cache->get($key);
         if ($cached) {
             $response = new WP_REST_Response($cached);
 			return $this->addCacheHeaders($response);
@@ -447,7 +449,7 @@
             ];
 
             // Cache the result
-            $this->cache->set($cache_key, $response, 'notifications_' . $user_id);
+            $this->cache->set($key, $response);
             $response = new WP_REST_Response($response);
 			return $this->addCacheHeaders($response);
         } catch (Exception $e) {

--
Gitblit v1.10.0