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/blocks/FeedBlock.php |   63 +++++++++++++++++--------------
 1 files changed, 35 insertions(+), 28 deletions(-)

diff --git a/inc/blocks/FeedBlock.php b/inc/blocks/FeedBlock.php
index 45a0959..1a23d95 100644
--- a/inc/blocks/FeedBlock.php
+++ b/inc/blocks/FeedBlock.php
@@ -1,7 +1,7 @@
 <?php
 namespace JVBase\blocks;
 
-use JVBase\managers\CacheManager;
+use JVBase\managers\Cache;
 use JVBase\utility\Features;
 use JVBase\utility\Checker;
 use JVBase\forms\TaxonomySelector;
@@ -13,41 +13,22 @@
 
 class FeedBlock
 {
-	protected CacheManager $cache;
+	protected Cache $cache;
 	protected array $config;
 	protected string $path = JVB_DIR.'/build/feed';
 
 	public function __construct()
 	{
 		// Initialize cache with connections
-		$this->cache = CacheManager::for('feed_block', WEEK_IN_SECONDS);
-		// Set up cache connections for all feed content types
-		$this->setupCacheConnections();
+		$this->cache = Cache::for('feed_block', WEEK_IN_SECONDS);
+
 		if (JVB_TESTING) {
-			$this->cache->clear();
+			$this->cache->flush();
 		}
 
 		add_action('init', [$this, 'registerBlock']);
 	}
 
-	/**
-	 * Set up cache connections for feed content
-	 */
-	protected function setupCacheConnections(): void
-	{
-		// Connect to all content types that show in feed
-		$contentTypes = Features::getTypesWithFeature('show_feed', 'content');
-		foreach ($contentTypes as $type) {
-			CacheManager::for('feed_content')->connectTo('post', $type);
-		}
-
-		// Connect to all taxonomies that show in feed
-		$taxonomies = Features::getTypesWithFeature('show_feed', 'taxonomy');
-		foreach ($taxonomies as $tax) {
-			CacheManager::for('feed_taxonomy')->connectTo('taxonomy', $tax);
-		}
-	}
-
 	public function registerBlock()
 	{
 		register_block_type($this->path, [
@@ -131,7 +112,7 @@
 
 		$this->config = $this->buildParams($attributes);
 		return $this->cache->remember(
-			$this->config,
+			$this->cache->generateKey($this->config),
 			function() {
 				return $this->renderBlock();
 			}
@@ -317,19 +298,45 @@
 							</label>
 
 							<input type="radio" id="order-date" class="btn" name="orderby" value="date" data-filter="orderby" checked>
-							<label for="order-date" title="Order by Date" class="row">
+							<label for="order-date" title="Order by Date Created" class="row">
 								<?= jvbIcon('calendar', ['title' => 'Date']) ?>
-								<span class="label">Date</span>
+								<span class="label">Date Created</span>
 							</label>
 
+							<input type="radio" id="order-modified" class="btn" name="orderby" value="modified" data-filter="orderby">
+							<label for="order-modified" title="Order by Date Modified" class="row">
+								<?= jvbIcon('clock-clockwise') ?>
+								<span class="label">Date Modified</span>
+							</label>
+
+							<?php
+								$custom = [];
+								foreach ($this->getContent() as $content) {
+									$config = JVB_CONTENT[$content]??JVB_TAXONOMY[$content]??JVB_USER[$content]??false;
+									if ($config && array_key_exists('custom_order', $config)) {
+										$custom = array_merge_recursive($custom, $config['custom_order']);
+									}
+								}
+								foreach ($custom as $slug => $conf) {
+									?>
+									<input type="radio" id="order-<?=$slug?>" class="btn" name="orderby" value="<?=$slug?>" data-for="<?=$conf['for']?>" data-filter="orderby">
+									<label for="order-<?=$slug?>" title="<?= $conf['label']?>" class="row">
+										<?= jvbIcon($conf['icon']) ?>
+										<span class="label"><?=$conf['label']?></span>
+									</label>
+									<?php
+								}
+								$custom = implode(',', array_keys($custom));
+							?>
 							<input type="radio" id="order-random" class="btn" name="orderby" value="random" data-filter="orderby">
 							<label for="order-random" title="Random Order" class="row">
 								<?= jvbIcon('shuffle') ?>
 								<span class="label">Random</span>
 							</label>
+
 						</div>
 
-						<div class="order-direction filter-group row start w-full" data-for-order="date,title">
+						<div class="order-direction filter-group row start w-full" data-for-order="date,modified,title<?= $custom === '' ? '' : ','.$custom?>">
 							<span class="label">ORDER:</span>
 							<input type="radio" id="order-desc" class="btn" name="order" value="desc" data-filter="order" checked>
 							<label for="order-desc" title="Sort Descending (A-Z, 1-10)" class="row">

--
Gitblit v1.10.0