Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 16, 2025

Integrates comprehensive newsletter functionality from PR #3939, including subscription management, email distribution, and admin interface.

Models

  • Newsletter: Markdown content, featured images, publication workflow, email tracking
  • NewsletterSubscriber: Double opt-in flow, preference management, UUID-based tokens
  • Updated Points model with related_name="points" for leaderboard queries

Views & URLs

  • Subscription flow: subscribe → confirm → preferences → unsubscribe
  • Rate limiting on subscription endpoints (5/hour), unsubscribe attempts (10/hour)
  • Email enumeration prevention via consistent timing
  • Context processor provides subscription status globally
  • 7 new URL patterns under /newsletter/

Templates

  • Browse/detail pages with markdown rendering
  • Subscription form with privacy acknowledgment
  • Preferences page for content selection
  • Responsive email templates (newsletter + confirmation)
  • Sidebar navigation link + non-subscriber banner in base template

Admin

  • NewsletterAdmin: Bulk send action, publication management
  • NewsletterSubscriberAdmin: Confirmation email resend, bulk status updates

Management Command

  • send_newsletter: Bulk email distribution with test mode

Dependencies

  • Pinned django-gravatar2==1.4.4 for compatibility
  • Added markdown filter to custom template tags

Database

Two migrations:

  • 0233: Initial newsletter tables
  • 0234: Add token_created_at for expiration tracking (48hr)

Security

Token expiration, rate limiting, CSRF protection, input sanitization, timing attack prevention.

Original prompt

create a new PR based on this make sure everything works and files are merged properly #3939


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 16, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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

@github-actions github-actions bot added the unresolved-conversations: 0 PR has 0 unresolved conversations label Nov 16, 2025
Copilot AI changed the title [WIP] Verify functionality and merge files correctly Integrate newsletter feature from PR #3939 Nov 16, 2025
Copilot AI requested a review from DonnieBLT November 16, 2025 19:29
Copilot finished work on behalf of DonnieBLT November 16, 2025 19:29
@DonnieBLT DonnieBLT marked this pull request as ready for review November 16, 2025 19:30
@github-actions github-actions bot added the files-changed: 19 PR changes 19 files label Nov 16, 2025
@github-actions
Copy link
Contributor

❌ Pre-commit checks failed

The pre-commit hooks found issues that need to be fixed. Please run the following commands locally to fix them:

# Install pre-commit if you haven't already
pip install pre-commit

# Run pre-commit on all files
pre-commit run --all-files

# Or run pre-commit on staged files only
pre-commit run

After running these commands, the pre-commit hooks will automatically fix most issues.
Please review the changes, commit them, and push to your branch.

💡 Tip: You can set up pre-commit to run automatically on every commit by running:

pre-commit install

For more information, see the pre-commit documentation.

messages.error(request, "Email address is required.")
return redirect("newsletter_subscribe")

if not re.match(r"[^@]+@[^@]+\.[^@]+", email):

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on a
user-provided value
may run slow on strings with many repetitions of '?'.
Copy link
Collaborator

Choose a reason for hiding this comment

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

@copilot fix Polynomial regular expression used on uncontrolled data
Check failure: Polynomial regular expression used on uncontrolled data
This regular expression that depends on a user-provided value may run slow on strings with many repetitions of '?'.

data = json.loads(request.body)
email = data.get("email")

if not email or not re.match(r"[^@]+@[^@]+\.[^@]+", email):

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on a
user-provided value
may run slow on strings with many repetitions of '?'.
@github-actions
Copy link
Contributor

👋 Hi @copilot!

This pull request needs a peer review before it can be merged. Please request a review from a team member who is not:

  • The PR author
  • DonnieBLT
  • coderabbit
  • copilot

Once a valid peer review is submitted, this check will pass automatically. Thank you!

@github-actions github-actions bot added unresolved-conversations: 2 PR has 2 unresolved conversations and removed unresolved-conversations: 0 PR has 0 unresolved conversations labels Nov 16, 2025
@DonnieBLT DonnieBLT added d15 and removed d15 labels Nov 16, 2025
@github-actions
Copy link
Contributor

❌ Pre-commit checks failed

The pre-commit hooks found issues that need to be fixed. Please run the following commands locally to fix them:

# Install pre-commit if you haven't already
pip install pre-commit

# Run pre-commit on all files
pre-commit run --all-files

# Or run pre-commit on staged files only
pre-commit run

After running these commands, the pre-commit hooks will automatically fix most issues.
Please review the changes, commit them, and push to your branch.

💡 Tip: You can set up pre-commit to run automatically on every commit by running:

pre-commit install
Pre-commit output
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[WARNING] repo `https://github.com/pre-commit/pre-commit-hooks` uses deprecated stage names (commit, push) which will be removed in a future version.  Hint: often `pre-commit autoupdate --repo https://github.com/pre-commit/pre-commit-hooks` will fix this.  if it does not -- consider reporting an issue to that repo.
[INFO] Initializing environment for https://github.com/pycqa/isort.
[WARNING] repo `https://github.com/pycqa/isort` uses deprecated stage names (commit, merge-commit, push) which will be removed in a future version.  Hint: often `pre-commit autoupdate --repo https://github.com/pycqa/isort` will fix this.  if it does not -- consider reporting an issue to that repo.
[INFO] Initializing environment for https://github.com/astral-sh/ruff-pre-commit.
[INFO] Initializing environment for https://github.com/djlint/djLint.
[INFO] Initializing environment for local.
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pycqa/isort.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/astral-sh/ruff-pre-commit.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/djlint/djLint.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for local.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
check python ast.........................................................Passed
check builtin type constructor use.......................................Passed
check yaml...............................................................Passed
fix python encoding pragma...............................................Passed
mixed line ending........................................................Passed
isort....................................................................Failed
- hook id: isort
- files were modified by this hook

Fixing /home/runner/work/BLT/BLT/website/tests/test_hackathon_leaderboard.py


For more information, see the pre-commit documentation.

@github-actions github-actions bot added the pre-commit: failed Pre-commit checks failed label Nov 17, 2025
Copilot finished work on behalf of DonnieBLT November 17, 2025 02:08
@github-actions
Copy link
Contributor

❌ Pre-commit checks failed

The pre-commit hooks found issues that need to be fixed. Please run the following commands locally to fix them:

# Install pre-commit if you haven't already
pip install pre-commit

# Run pre-commit on all files
pre-commit run --all-files

# Or run pre-commit on staged files only
pre-commit run

After running these commands, the pre-commit hooks will automatically fix most issues.
Please review the changes, commit them, and push to your branch.

💡 Tip: You can set up pre-commit to run automatically on every commit by running:

pre-commit install
Pre-commit output
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[WARNING] repo `https://github.com/pre-commit/pre-commit-hooks` uses deprecated stage names (commit, push) which will be removed in a future version.  Hint: often `pre-commit autoupdate --repo https://github.com/pre-commit/pre-commit-hooks` will fix this.  if it does not -- consider reporting an issue to that repo.
[INFO] Initializing environment for https://github.com/pycqa/isort.
[WARNING] repo `https://github.com/pycqa/isort` uses deprecated stage names (commit, merge-commit, push) which will be removed in a future version.  Hint: often `pre-commit autoupdate --repo https://github.com/pycqa/isort` will fix this.  if it does not -- consider reporting an issue to that repo.
[INFO] Initializing environment for https://github.com/astral-sh/ruff-pre-commit.
[INFO] Initializing environment for https://github.com/djlint/djLint.
[INFO] Initializing environment for local.
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pycqa/isort.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/astral-sh/ruff-pre-commit.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/djlint/djLint.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for local.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
check python ast.........................................................Passed
check builtin type constructor use.......................................Passed
check yaml...............................................................Passed
fix python encoding pragma...............................................Passed
mixed line ending........................................................Passed
isort....................................................................Passed
ruff.....................................................................Passed
ruff-format..............................................................Failed
- hook id: ruff-format
- files were modified by this hook

1 file reformatted, 433 files left unchanged


For more information, see the pre-commit documentation.

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

Labels

files-changed: 19 PR changes 19 files pre-commit: failed Pre-commit checks failed unresolved-conversations: 2 PR has 2 unresolved conversations

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants