Jake Vanderwerf
2026-08-26 18e7e415339ccc9adf8ade562f93abef606da16d
inc/rest/routes/NewsRoutes.php
@@ -1,6 +1,7 @@
<?php
namespace JVBase\rest\routes;
use JVBase\Instance;
use JVBase\rest\PermissionHandler;
use JVBase\rest\Rest;
use JVBase\meta\Meta;
@@ -17,6 +18,7 @@
class NewsRoutes extends Rest
{
   use Instance;
    protected int $per_page;
    protected bool|object $manager = false;
    public function __construct()
@@ -77,7 +79,7 @@
     */
    public function handleNewsOperation(WP_REST_Request $request):WP_REST_Response
    {
        $queue = JVB()->queue();
        $queue = Queue::getInstance();
        $data = $request->get_params();
        $user = get_current_user_id();
        $operationID = sanitize_text_field($data['id']);
@@ -106,8 +108,8 @@
    public function getNews(WP_REST_Request $request):WP_REST_Response
    {
        $args = $this->buildQueryArgs($request);
        $key = $this->cache->generateKey($args);
        $cache = $this->cache->get($key);
        $cache = $this->cache->get($args);
        if ($cache) {
             return $this->success($cache);
        }
@@ -123,7 +125,7 @@
            'total_pages'   => $query->max_num_pages
        ];
        $this->cache->set($key, $results);
        $this->cache->set($args, $results);
        return $this->success($results);
    }
@@ -323,7 +325,7 @@
        $artist = jvbContentFromUser($post->post_author);
        $upvotes = (int) get_post_meta($post->ID, BASE.'upvotes', true);
        $downvotes = (int) get_post_meta($post->ID, BASE.'downvotes', true);
        $comments = JVB()->routes('comments')->getItemResponse($post->ID, BASE.'news');
        $comments = ResponseRoutes::getInstance()->getItemResponse($post->ID, ['post_type' => BASE.'news']);
        return [
            'id'            => $post->ID,