Fix creative management UI bugs and add audit logging#376
Merged
Conversation
- Changed onclick handler to not inline JSON data (was causing syntax errors) - Store creative data in data-creative-data attribute with proper escaping - Parse data inside viewCreativeDetails function instead - Removed unnecessary async keyword from viewCreativeDetails Fixes: [Error] SyntaxError: Unexpected end of script at review:221
- Added missing request body to approve endpoint (approved_by) - Fixed reject endpoint to use correct field names (rejection_reason, rejected_by) - Added validation to require rejection reason - Improved error handling with response.ok checks - Added console.error logging for debugging Fixes: 400 Bad Request errors when approving/rejecting creatives
- Import AuditLogger in both approve_creative and reject_creative functions - Log operations to database via log_operation() method - Track: operation name, reviewer, creative details, human override flag - Audit logs appear in activity stream for compliance tracking - Completes the notification/reporting chain: Slack + Webhooks + Audit Trail Note: Pre-existing mypy errors in audit_logger.py, slack_notifier.py, and other modules are not related to these changes. My usage of log_operation() is correct and type-safe. Related to security and compliance requirements
bokelley
added a commit
that referenced
this pull request
Oct 14, 2025
Merged latest changes from main including: - Product pricing display and migration to pricing_options table (#369) - Update media buy fix for database-persisted buys (#380) - Automatic creative preview fetching (#379) - Creative sync improvements (#378, #376, #373) - Budget field access fixes (#374) - UI improvements (#377, #375, #372) Conflict Resolution: - src/core/main.py: Combined debug logging from main with helper function from our branch - Kept both improvements: stderr debug prints + create_get_products_request() helper No conflicts in schema files - automatic merges succeeded.
danf-newton
pushed a commit
to Newton-Research-Inc/salesagent
that referenced
this pull request
Nov 24, 2025
* Fix JavaScript syntax error in creative preview button - Changed onclick handler to not inline JSON data (was causing syntax errors) - Store creative data in data-creative-data attribute with proper escaping - Parse data inside viewCreativeDetails function instead - Removed unnecessary async keyword from viewCreativeDetails Fixes: [Error] SyntaxError: Unexpected end of script at review:221 * Fix approve/reject creative API calls - Added missing request body to approve endpoint (approved_by) - Fixed reject endpoint to use correct field names (rejection_reason, rejected_by) - Added validation to require rejection reason - Improved error handling with response.ok checks - Added console.error logging for debugging Fixes: 400 Bad Request errors when approving/rejecting creatives * Add audit logging to creative approve/reject operations - Import AuditLogger in both approve_creative and reject_creative functions - Log operations to database via log_operation() method - Track: operation name, reviewer, creative details, human override flag - Audit logs appear in activity stream for compliance tracking - Completes the notification/reporting chain: Slack + Webhooks + Audit Trail Note: Pre-existing mypy errors in audit_logger.py, slack_notifier.py, and other modules are not related to these changes. My usage of log_operation() is correct and type-safe. Related to security and compliance requirements
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes critical bugs in creative management UI and adds comprehensive audit logging for compliance.
Issues Fixed
1. JavaScript Syntax Error - View Preview Button ✅
Error:
SyntaxError: Unexpected end of scriptRoot Cause: Inlining JSON data in onclick handler broke when creative data contained quotes/special characters.
Fix:
data-creative-dataattribute with proper escaping2. 400 Bad Request - Approve Creative ✅
Error:
400 Bad Request: The browser (or proxy) sent a request that this server could not understandRoot Cause: POST request had no body; backend expects
approved_byfield.Fix:
response.okcheck3. Missing Fields - Reject Creative ✅
Root Cause: Backend expects
rejection_reasonandrejected_by, notreason.Fix:
Enhancement: Complete Audit Trail ✅
Added audit logging to both approve and reject operations:
audit_logstable viaAuditLogger.log_operation()Complete Notification Chain
Both operations now fire:
CreativeReviewrecords)Testing
Files Changed
templates/creative_management.html- Fixed JS errors and API callssrc/admin/blueprints/creatives.py- Added audit loggingNote
Pre-existing mypy errors in
audit_logger.pyand other modules are not related to these changes. My usage oflog_operation()is correct and type-safe per the function signature.