Skip to content

Hotfix: Code clean up#845

Merged
chrismaddalena merged 22 commits intomasterfrom
hotfix/code-clean-up
Mar 18, 2026
Merged

Hotfix: Code clean up#845
chrismaddalena merged 22 commits intomasterfrom
hotfix/code-clean-up

Conversation

@chrismaddalena
Copy link
Collaborator

This PR includes several small adjustments to clean up some code and fix some color contrast in dark mode.

Copilot AI review requested due to automatic review settings March 17, 2026 22:57
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR focuses on small cleanup improvements and dark-mode contrast fixes, plus robustness updates around file/logo previews and downloads.

Changes:

  • Prevent leaked blob: object URLs in image preview JavaScript by revoking URLs after use.
  • Improve dark-mode contrast for buttons/icons/sidebar header tabs via updated CSS colors.
  • Harden client logo download behavior and add test coverage for clients without logos.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
ghostwriter/static/js/project.js Adds blob: URL revocation logic for image/avatar previews to reduce memory leaks.
ghostwriter/static/css/styles.css Adjusts dark-theme text/icon colors for better contrast and adds sidebar header tab color.
ghostwriter/rolodex/views.py Fixes docstring and returns 404 when a client has no logo path (avoids 500).
ghostwriter/rolodex/tests/test_views.py Adds a regression test ensuring “no logo” returns 404.
ghostwriter/rolodex/templates/rolodex/client_detail.html Appends ?view=true to client logo image URL.
ghostwriter/rolodex/forms_project.py Removes a save side-effect from formset clean() logic.
ghostwriter/rolodex/forms_client.py Removes a save side-effect from formset clean() logic.
ghostwriter/reporting/forms.py Simplifies file input label copy.
ghostwriter/home/forms.py Refactors avatar upload form layout and adds inline JS for file label updates.

@codecov
Copy link

codecov bot commented Mar 17, 2026

Codecov Report

❌ Patch coverage is 95.74468% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.62%. Comparing base (86acfd2) to head (221ba7b).
⚠️ Report is 23 commits behind head on master.

Files with missing lines Patch % Lines
...rting/migrations/0063_set_report_field_defaults.py 83.33% 1 Missing ⚠️
ghostwriter/rolodex/views.py 92.85% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #845      +/-   ##
==========================================
+ Coverage   91.60%   91.62%   +0.01%     
==========================================
  Files         373      373              
  Lines       21488    21520      +32     
==========================================
+ Hits        19685    19717      +32     
  Misses       1803     1803              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR performs small cleanup and UX tweaks across Ghostwriter’s Django UI: improving dark-mode contrast, tightening file-upload UI text, preventing blob URL leaks in client-side previews, and hardening a client-logo download view against missing logos.

Changes:

  • Improve object URL lifecycle handling for image/avatar previews in project.js.
  • Adjust dark-mode button/icon text colors and add dark-mode styling for .sidebar-header-tab.
  • Fix ClientLogoDownload docstring + add 404 behavior when a client has no logo, with a matching test.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
ghostwriter/static/js/project.js Revoke blob URLs for preview images to reduce memory leaks.
ghostwriter/static/css/styles.css Dark-mode contrast tweaks for buttons/icons and sidebar header tab color.
ghostwriter/rolodex/views.py Handle missing client logo (ValueError) by returning 404 instead of 500; docstring fix.
ghostwriter/rolodex/tests/test_views.py Add regression test ensuring “no logo” returns 404.
ghostwriter/rolodex/templates/rolodex/client_detail.html Append ?view=true to client logo URL.
ghostwriter/rolodex/forms_project.py Remove saving model instances during formset clean() primary auto-selection.
ghostwriter/rolodex/forms_client.py Same as above for client contacts formset.
ghostwriter/reporting/forms.py Shorten evidence upload label text.
ghostwriter/home/forms.py Refactor avatar upload field layout/markup and inline JS for filename display.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR focuses on small cleanup and UX tweaks across the Django and static front-end layers, including dark-mode contrast improvements and safer handling of uploaded/served files.

Changes:

  • Prevent object-URL leaks in image preview rendering for evidence and avatar uploads.
  • Improve dark-mode button/icon/sidebar header text contrast.
  • Harden/extend client logo download behavior (404 handling when no logo, optional inline view with headers) and add a migration guard for orphaned Report rows.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
ghostwriter/static/js/project.js Reworks image preview blob URL lifecycle (create/revoke) for evidence and avatar previews.
ghostwriter/static/css/styles.css Adjusts dark theme text color for buttons/icons and adds sidebar header tab color for contrast.
ghostwriter/rolodex/views.py Updates client logo download view: handles missing logos safely, adds content type + headers, supports optional inline viewing.
ghostwriter/rolodex/tests/test_views.py Adds coverage for the “client has no logo” path to ensure 404 instead of 500.
ghostwriter/rolodex/templates/rolodex/client_detail.html Requests inline logo rendering via ?view=true for client detail display.
ghostwriter/rolodex/forms_project.py Removes saving side-effects from formset clean() when auto-setting a primary contact.
ghostwriter/rolodex/forms_client.py Removes saving side-effects from formset clean() when auto-setting a primary contact.
ghostwriter/reporting/migrations/0064_alter_report_project.py Converts an accidental migration into an empty no-op to preserve migration history.
ghostwriter/reporting/migrations/0063_set_report_field_defaults.py Adds a precondition check blocking NOT NULL enforcement if orphaned reports exist; removes arbitrary FK default.
ghostwriter/reporting/forms.py Fixes file input label for= to match id_document and updates helper text.
ghostwriter/home/forms.py Adjusts avatar upload widget/layout and introduces custom label + filename display handling.

@chrismaddalena chrismaddalena merged commit 51b0af5 into master Mar 18, 2026
6 of 7 checks passed
@chrismaddalena chrismaddalena deleted the hotfix/code-clean-up branch March 18, 2026 00:30
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.

2 participants