| | |
| | | |
| | | use JVBase\managers\Cache; |
| | | use JVBase\managers\CustomTable; |
| | | use JVBase\registrar\Registrar; |
| | | use JVBase\rest\Rest; |
| | | use JVBase\rest\Route; |
| | | use WP_REST_Request; |
| | |
| | | public function init(): void |
| | | { |
| | | $this->manager = JVB()->notification(); |
| | | $this->notification_types = $this->manager->getNotificationTypes(); |
| | | $this->notification_types = $this->manager->getNotificationTypes(true); |
| | | } |
| | | |
| | | /** |
| | |
| | | 'offset' => 'integer|default:0', |
| | | ]) |
| | | ->auth('user') |
| | | ->rateLimit(30); |
| | | ->rateLimit(30) |
| | | ->register(); |
| | | |
| | | // Mark as read |
| | | Route::for('notifications/read') |
| | |
| | | 'notification_id' => 'integer|required', |
| | | ]) |
| | | ->auth('user') |
| | | ->rateLimit(30); |
| | | ->rateLimit(30) |
| | | ->register(); |
| | | |
| | | // Mark all as read |
| | | Route::for('notifications/read-all') |
| | |
| | | 'type' => 'string', |
| | | ]) |
| | | ->auth('user') |
| | | ->rateLimit(10); |
| | | ->rateLimit(10) |
| | | ->register(); |
| | | |
| | | // Mark as actioned |
| | | Route::for('notifications/action') |
| | |
| | | 'notification_id' => 'integer|required', |
| | | ]) |
| | | ->auth('user') |
| | | ->rateLimit(30); |
| | | ->rateLimit(30) |
| | | ->register(); |
| | | |
| | | // Dismiss notification |
| | | Route::for('notifications/dismiss') |
| | |
| | | 'notification_id' => 'integer|required', |
| | | ]) |
| | | ->auth('user') |
| | | ->rateLimit(30); |
| | | ->rateLimit(30) |
| | | ->register(); |
| | | |
| | | // Get unread count |
| | | Route::for('notifications/count') |
| | |
| | | 'type' => 'string', |
| | | ]) |
| | | ->auth('user') |
| | | ->rateLimit(60); |
| | | ->rateLimit() |
| | | ->register(); |
| | | } |
| | | |
| | | // ========================================================================= |
| | |
| | | $statusCondition = $wpdb->prepare("a.status = %s", $status); |
| | | } |
| | | |
| | | $approvals = jvbApprovalTypes(); |
| | | $approvals = Registrar::getFeatured('approve_new'); |
| | | foreach ($approvals as $type => $config) { |
| | | $table = $wpdb->prefix . BASE . 'approval_' . $type . 'requests'; |
| | | $votes = $wpdb->prefix . BASE . 'approval_' . $type . 'votes'; |