Jake Vanderwerf
2026-07-05 fff721dd185f5b97f7ae7a6e64189e55887ff590
inc/rest/routes/ApprovalRoutes.php
@@ -41,11 +41,11 @@
        $this->termTypes = [];
      $this->allTypes = [];
        if ($this->hasMemberApproval) {
            $this->userTypes = Registrar::getFeatured('approve_new', 'user');
            $this->userTypes = Registrar::withFeature('approve_new', 'user');
            $this->allTypes = $this->userTypes;
        }
        if (Site::has('term_approval')) {
            $this->termTypes = Registrar::getFeatured('approve_new', 'term');
            $this->termTypes = Registrar::withFeature('approve_new', 'term');
            $this->allTypes[] = 'term';
        }
    }
@@ -55,7 +55,6 @@
      Route::for('approvals')
         ->get([$this, 'getApprovals'])
         ->args([
            'user' => 'integer|required',
            'type' => 'string',
            'status' => 'string|enum:pending,approved,rejected,expired',
         ])
@@ -63,7 +62,6 @@
         ->rateLimit(30)
         ->post([$this, 'handleAction'])
         ->args([
            'user' => 'integer|required',
            'request_id' => 'integer|required',
            'action' => 'string|required|enum:approve,reject',
            'type' => 'string|required',
@@ -84,7 +82,7 @@
    {
      $data = $request->get_params();
      $request_id = absint($data['request_id']);
      $user_id = absint($data['user']);
      $user_id = get_current_user_id();
      $action = sanitize_text_field($data['action']);
      $type = sanitize_text_field($data['type']);
      $notes = sanitize_text_field($data['notes'] ?? '');
@@ -208,14 +206,10 @@
   public function getApprovals(WP_REST_Request $request): WP_REST_Response
   {
      $user_id = absint($request->get_param('user'));
      $user_id = get_current_user_id();
      $type = sanitize_text_field($request->get_param('type') ?? 'all');
      $status = sanitize_text_field($request->get_param('status') ?? 'pending');
      if (!$this->checkUser($user_id)) {
         return $this->unauthorized();
      }
      $cacheKey = compact('user_id', 'type', 'status');
      $result = $this->cache->remember($cacheKey, function() use ($type, $status) {