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/managers/KarmaManager.php |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/inc/managers/KarmaManager.php b/inc/managers/KarmaManager.php
index 6bba6da..7b4cccc 100644
--- a/inc/managers/KarmaManager.php
+++ b/inc/managers/KarmaManager.php
@@ -60,7 +60,7 @@
 //				break;
 //		}
 		if (!isset(self::$cache)) {
-			self::$cache = Cache::for('user_karma')->connect('user');
+			self::$cache = Cache::for('user_karma')->connect('user')->user();
 		}
 
 		add_filter(BASE.'handle_bulk_operation', [$this, 'processOperation'], 10, 3);
@@ -122,7 +122,7 @@
 	protected function defineTable():bool
 	{
 		$table = CustomTable::for('karma_'.$this->key);
-		[$type, $table, $column] = $this->getReferenceTable($table);
+		[$type, $referenceTable, $column] = $this->getReferenceTable($table);
 		if (!$type) {
 			error_log('[KarmaManager]::defineTable Attempted to build reference for invalid table: '.$this->references);
 			CustomTable::destroyInstance('karma_'.$this->key);
@@ -134,7 +134,7 @@
 			'item_id'	=> "{$type} NOT NULL",
 			'user_id'	=> "{$table->getUserIDType()} NOT NULL",
 			'content'	=> 'varchar(255) NOT NULL',
-			'vote'		=> "ENUM('up,'down') NOT NULL",
+			'vote'		=> "ENUM('up','down') NOT NULL",
 			'created_at'=> 'datetime NOT NULL DEFAULT CURRENT_TIMESTAMP',
 			'updated_at'=> 'datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'
 		]);
@@ -147,9 +147,9 @@
 		]);
 		$base = BASE;
 		$table->setConstraints([
-			"CONSTRAINT `{$base}kt_{$type}_item_id` FOREIGN KEY (`item_id`)
-			REFERENCES `{$table}` (`{$column}`) ON DELETE CASCADE",
-			"CONSTRAINT `{$base}kt_{$type}_user_id` FOREIGN KEY (`user_id`)
+			"CONSTRAINT `{$base}kt_{$this->key}_{$type}_item_id` FOREIGN KEY (`item_id`)
+			REFERENCES `{$referenceTable}` (`{$column}`) ON DELETE CASCADE",
+			"CONSTRAINT `{$base}kt_{$this->key}_{$type}_user_id` FOREIGN KEY (`user_id`)
 			REFERENCES `{$table->getUserTable()}` (`ID`) ON DELETE CASCADE"
 		]);
 		$table->defineTable();

--
Gitblit v1.10.0