Skip to content

Add endpoint to update notification state by ID - #611

Open
AshishJii wants to merge 3 commits into
WordPress:developfrom
AshishJii:feat/update-notif
Open

AshishJii wants to merge 3 commits into
WordPress:developfrom
AshishJii:feat/update-notif

Conversation

@AshishJii

@AshishJii AshishJii commented Oct 15, 2026 •

Copy link
Copy Markdown

What

Adds the PUT /wp-notifications/v1/notifications/{id} endpoint and repository support to update per-user notification state.

How

Registered the item route in Notification_Controller with an authentication check, UTC date normalization, and error handling for invalid or empty payloads. Extended Notification_Repository and Wpdb_Notification_Repository with update_state(), scoping queue table updates to both message_id and the current user_id. Added PHPUnit test coverage for route handling and auth.

Testing Instructions

PHPUnit suite:
npx wp-env run tests-cli -- /var/www/html/wp-content/plugins/wp-feature-notifications/vendor/bin/phpunit --configuration=/var/www/html/wp-content/plugins/wp-feature-notifications/phpunit.xml.dist --filter WP_Test_REST_Notification_Controller

PHPCS:
vendor/bin/phpcs --standard=phpcs.xml.dist includes/restapi/ includes/persistence/

Closes #376

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MVP Notification Controller: PUT /notifications /{id}

1 participant