Conversation
Expose operator notification config with secret redaction, validated PATCH updates, delivery log filters, and relay-named test messages. Closes #760.
🦋 Changeset detectedLatest commit: dc3cbcb The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
| if (existing) { | ||
| if (isRedactedSecret(incoming.url) || (incoming.url === undefined && existing.url)) { | ||
| merged.url = existing.url | ||
| } | ||
| if (isRedactedSecret(incoming.botToken) || (incoming.botToken === undefined && existing.botToken)) { | ||
| merged.botToken = existing.botToken | ||
| } | ||
| } |
There was a problem hiding this comment.
Placeholder Becomes Telegram Token
When a new or renamed Telegram target sends the redacted *** value, this code restores the secret only if an existing target has the same ID. Otherwise, it saves *** as the real bot token because validation only checks that the token is non-empty. The update succeeds, but later Telegram test and notification deliveries fail with unusable credentials. Reject the placeholder when there is no matching stored secret.
| const validation = validateSchema(adminNotificationsPatchBodySchema)(request.body) | ||
| if (validation.error) { | ||
| response.status(400).setHeader('content-type', 'application/json').send({ error: 'Invalid request' }) | ||
| return | ||
| } | ||
|
|
There was a problem hiding this comment.
This new write endpoint has no controller-level tests for request validation, persistence, redacted-secret round trips, or outbox failures. The added merge test covers only an existing Discord target, so cases such as a new Telegram target receiving *** are not protected against regressions. As a non-blocking improvement, add PATCH controller tests for valid partial updates, invalid bodies, new and existing secret-bearing targets, and enqueue failures.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Description
This PR adds admin HTTP API for operator notifications on top of the backend from #759 / #781:
/admin/notifications— currentadmin.notificationsconfig with webhook URLs and tokens redacted/admin/notifications— updateenabled, targets, event toggles, retry policy, and retention; validates like settings; preserves secrets when the client sends***forurl/botToken/admin/notifications/deliveries— optionalstatusandeventTypequery filters (limit validation unchanged)/admin/notifications/test— test message text uses the relay name:Test notification from <name|relay_url>Related Issue
Closes :- #760
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: