Jake Vanderwerf
2026-08-28 a9654f00c8fbc9934289d761843ddd071025013f
inc/rest/routes/FavouritesRoutes.php
@@ -4,7 +4,10 @@
use JVBase\Instance;
use JVBase\managers\Cache;
use JVBase\managers\CustomTable;
use JVBase\managers\Emails;
use JVBase\managers\Favourites;
use JVBase\managers\NotificationManager;
use JVBase\managers\queue\Queue;
use JVBase\registrar\Registrar;
use JVBase\rest\PermissionHandler;
use JVBase\rest\Response;
@@ -553,7 +556,7 @@
            // Get list items
            $items = $this->listItems
               ->where(['list_id' => $list_id])
               ->orderBy('added_at', 'DESC')
               ->orderBy('added_at')
               ->getResults();
            // Format items - convert to favourite-like objects
@@ -578,10 +581,11 @@
            // Get shared users if owner
            $shared_users = [];
            $is_owner = false;//TODO
            if ($is_owner) {
               $shares = $this->listShares
                  ->where(['list_id' => $list_id])
                  ->orderBy('created_at', 'DESC')
                  ->orderBy('created_at')
                  ->getResults();
               foreach ($shares as $share_item) {
@@ -600,7 +604,7 @@
                  $shared_users[] = $shared_user;
               }
            }
            $list = []; //TODO: check this
            return [
               'success' => true,
               'list' => [
@@ -1027,19 +1031,20 @@
            ]);
            // Send notification
            NotificationManager::getInstance()->addNotification(
               $share_user->ID,
               'list_shared',
               $user_id,
               sprintf('%s shared a favorites list with you: "%s"', $owner_name, $list->name),
               $list_id,
               'favourites_list',
               [
                  'list_id' => $list_id,
                  'list_name' => $list->name,
                  'permission_type' => $permission_type
               ]
            );
            // TODO This should be handled by the Favourites:: manager
//          NotificationManager::getInstance()->addNotification(
//             $share_user->ID,
//             'list_shared',
//             $user_id,
//             sprintf('%s shared a favorites list with you: "%s"', $owner_name, $list->name),
//             $list_id,
//             'favourites_list',
//             [
//                'list_id' => $list_id,
//                'list_name' => $list->name,
//                'permission_type' => $permission_type
//             ]
//          );
            return [
               'success' => true,
@@ -1338,7 +1343,7 @@
      // For posts
      if (str_contains($type, 'post') || in_array($type, array_keys($this->valid_types))) {
         $post = get_post($target_id);
         return $post ? $post->post_author : null;
         return $post?->post_author;
      }
      // For terms (shops, etc.)
@@ -1579,7 +1584,7 @@
      };
      if (!$operation_type) {
         return $this->error('Invalid action', 'invalid_action', 400);
         return $this->error('Invalid action', 'invalid_action');
      }
      Queue::getInstance()->queueOperation(