Skip to content

Issue #403: Add organization branding customization to unsubscribe page#432

Open
pushkar444 wants to merge 2 commits into
Kuldeeep18:mainfrom
pushkar444:issue-403-unsubscribe-customization
Open

Issue #403: Add organization branding customization to unsubscribe page#432
pushkar444 wants to merge 2 commits into
Kuldeeep18:mainfrom
pushkar444:issue-403-unsubscribe-customization

Conversation

@pushkar444

@pushkar444 pushkar444 commented Jun 23, 2026

Copy link
Copy Markdown

Pull Request

🔗 Related Issue

Closes #403


📝 Summary of Changes

  • Added unsubscribe_title field to the Organization model.
  • Added unsubscribe_message field to the Organization model.
  • Added brand_logo_url field to the Organization model.
  • Created a migration for the new organization branding fields.
  • Updated the unsubscribe confirmation page to display organization-specific title and message.
  • Added support for displaying the organization's logo on the unsubscribe page.
  • Preserved default behavior when custom branding fields are not configured.

🏷️ Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • ♻️ Refactor
  • 📝 Documentation update
  • 🎨 UI / Style change
  • 🔧 Chore

🧪 Testing

Steps to test:

  1. Run migrations to add the new Organization fields.
  2. Configure unsubscribe_title, unsubscribe_message, and brand_logo_url for an organization.
  3. Open an unsubscribe link for a lead belonging to that organization.
  4. Verify that the custom title, message, and logo are displayed.
  5. Verify that the default content is shown when the branding fields are empty.
  6. Run python -m py_compile campaigns/views.py to confirm there are no syntax errors.

📸 Screenshots (if applicable)

N/A


✅ Checklist

  • No merge conflicts
  • Changes follow the project guidelines
  • Documentation updated (if applicable)
  • Related issue linked
  • Changes tested locally (if applicable)

Summary by CodeRabbit

Release Notes

  • New Features
    • Organizations can now personalize their unsubscribe experience with a custom title, custom message, and optional brand logo, shown consistently on both the confirmation and “unsubscribed” pages.
  • Bug Fixes
    • Improved rendering of unsubscribe content to prevent unintended HTML output and ensure the logo, title, and message display safely.

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 880d631c-6467-4467-b7ae-dce1dcd89432

📥 Commits

Reviewing files that changed from the base of the PR and between ddd9961 and e98ea32.

📒 Files selected for processing (1)
  • backend/campaigns/views.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • backend/campaigns/views.py

📝 Walkthrough

Walkthrough

Three nullable fields (brand_logo_url, unsubscribe_title, unsubscribe_message) are added to the Organization model along with a corresponding Django migration. The unsubscribe_view and _unsubscribe_page helper are updated to read these fields and render the organization logo and custom text on the unsubscribe page.

Changes

Unsubscribe Page Branding Customization

Layer / File(s) Summary
Organization model fields and migration
backend/tenants/models.py, backend/tenants/migrations/0003_organization_brand_logo_url_and_more.py
Three optional nullable fields (unsubscribe_title, unsubscribe_message, brand_logo_url) are added to Organization, with the accompanying migration depending on tenants/0002_organization_enable_ai_personalization_and_more.
Unsubscribe view branding wiring
backend/campaigns/views.py
_unsubscribe_page gains a logo_url parameter and conditionally builds logo_html with HTML escaping. unsubscribe_view derives custom_title, custom_message, and logo_url from the organization (falling back to defaults) and passes logo_url to _unsubscribe_page on both the GET confirmation path and the POST completion path.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Hop hop, the logo appears,
A brand new banner calms unsubscribe fears,
Three fields in the model, neat and small,
A migration to carry them once and for all,
The page now shines with the org's own hue —
One tidy PR, beautifully through! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding organization branding customization to the unsubscribe page, which aligns with the primary objective.
Linked Issues check ✅ Passed The PR successfully implements all requirements from issue #403: extends Organization model with three branding fields, creates migration, updates unsubscribe view to fetch organization details and render custom content dynamically, includes proper HTML escaping for security.
Out of Scope Changes check ✅ Passed All changes are directly scoped to issue #403 requirements: Organization model fields, migration, and unsubscribe page customization. No extraneous modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@backend/campaigns/views.py`:
- Around line 721-724: The _unsubscribe_page function interpolates parameters
like title, message, and logo_url directly into HTML without escaping them.
Since these values come from DB-configurable organization fields (lines
760-770), this creates a stored XSS vulnerability on the public unsubscribe
page. Import Django's escape function (or mark_safe for trusted content) and
apply it to escape title, message, and logo_url before they are inserted into
the HTML strings on lines 723 and 740. Ensure all user-supplied organization
fields are properly escaped before HTML interpolation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d4805950-d18c-4d5d-a97f-bace8f5467fd

📥 Commits

Reviewing files that changed from the base of the PR and between ab66c79 and ddd9961.

📒 Files selected for processing (3)
  • backend/campaigns/views.py
  • backend/tenants/migrations/0003_organization_brand_logo_url_and_more.py
  • backend/tenants/models.py

Comment thread backend/campaigns/views.py Outdated
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.

LO-066 [Easy]: HTML Unsubscribe Page Styling Customization

1 participant