From ac444cba221832c012c0435fdc8339fe9f37febb Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Mon, 11 May 2026 18:35:04 +0000
Subject: [PATCH] =Some changes to the CRUD.js editing, timeline post configuration
---
inc/managers/queue/Storage.php | 24 +++++++++++++++++-------
1 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/inc/managers/queue/Storage.php b/inc/managers/queue/Storage.php
index 3c580df..40426e6 100644
--- a/inc/managers/queue/Storage.php
+++ b/inc/managers/queue/Storage.php
@@ -266,14 +266,24 @@
return $row ? $this->rowToOperation($row) : null;
}
- public function findMergeable(string $type, int $userId): ?Operation
+ public function findMergeable(string $type, int $userId, array $criteria = []): ?Operation
{
- $row = $this->wpdb->get_row($this->wpdb->prepare(
- "SELECT * FROM {$this->table}
- WHERE type = %s AND user_id = %d AND state IN ('pending', 'scheduled')
- ORDER BY created_at DESC LIMIT 1",
- $type, $userId
- ));
+ $sql = "SELECT * FROM {$this->table}
+ WHERE type = %s AND user_id = %d AND state IN ('pending', 'scheduled')";
+ $params = [$type, $userId];
+
+ foreach ($criteria as $key => $value) {
+ if ($value === null) {
+ continue;
+ }
+ $sql .= " AND JSON_UNQUOTE(JSON_EXTRACT(request_data, %s)) = %s";
+ $params[] = '$.' . $key;
+ $params[] = (string) $value;
+ }
+
+ $sql .= " ORDER BY created_at DESC LIMIT 1";
+
+ $row = $this->wpdb->get_row($this->wpdb->prepare($sql, ...$params));
$this->invalidateUser($userId);
--
Gitblit v1.10.0