Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "feat: add beehiiv integration" #238

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

losndu
Copy link
Collaborator

@losndu losndu commented Jan 15, 2025

Reverts #235

Summary by CodeRabbit

  • Refactor

    • Removed Beehiiv integration configurations and related code
    • Simplified Celery worker configuration
    • Removed newsletter subscriber synchronization tasks
    • Deleted Beehiiv-specific environment variables and configuration files
  • Documentation

    • Updated README.md and environment example files to remove Beehiiv references
  • Chores

    • Cleaned up unused code and configuration settings related to Beehiiv integration

Copy link

coderabbitai bot commented Jan 15, 2025

Walkthrough

This pull request involves a comprehensive removal of Beehiiv integration from the project. The changes systematically eliminate all Beehiiv-related configurations, environment variables, tasks, models, and client implementations across multiple files. The modifications include deleting the Beehiiv client, removing subscriber synchronization tasks, dropping Beehiiv-specific model fields, and cleaning up configuration files related to Celery and environment settings.

Changes

File Change Summary
README.md Removed Beehiiv environment variable configurations and simplified Celery worker command
server/.env.example Deleted Beehiiv-related configuration variables
server/apps/newsletter/beehiiv.py Completely removed Beehiiv client implementation
server/apps/newsletter/migrations/0012_* Deleted migration file for Beehiiv-related model changes
server/apps/newsletter/models.py Removed beehiiv_id, synced_to_beehiiv, and sync_error fields from Subscriber model
server/apps/newsletter/tasks.py Eliminated all Beehiiv subscriber synchronization tasks
server/core/celery.py Removed Beehiiv-related scheduled tasks
server/core/config/beehiiv.py Deleted entire configuration file for Beehiiv
server/core/config/celery_config.py Removed Beehiiv-specific Celery configurations

Possibly related PRs

  • feat: add beehiiv integration #235: The main PR removes Beehiiv integration settings, while this PR adds new settings for Beehiiv integration
  • feat: add view #236: The main PR's removal of subscriber synchronization tasks is related to this PR, which introduces a new task for syncing subscribers to Beehiiv

Poem

🐰 Farewell, Beehiiv, you've buzzed your last,
Our code now clean, integration past.
No more syncs, no more queues so neat,
A rabbit's cleanup - now that's a treat!
Hop away, integration light! 🌟

Finishing Touches

  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@losndu losndu merged commit 7863b33 into main Jan 15, 2025
4 of 5 checks passed
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🔭 Outside diff range comments (1)
README.md (1)

Line range hint 1-211: Document the removal of Beehiiv environment variables.

The environment variables section should be updated to remove references to the deleted Beehiiv configuration. Consider adding a note about the removal of Beehiiv integration to help users understand this architectural change.

Add this section under the environment variables documentation:

   ```env
    DJANGO_SETTINGS_MODULE='core.config.local' #for Dev environment

    # Sqlite3 database config
    SECRET_KEY='paste db.sqlite3 key here'

+   # Note: Beehiiv integration was removed in PR #238.
+   # The following environment variables are no longer needed:
+   # - BEEHIIV_ENABLED
+   # - BEEHIIV_API_KEY
+   # - BEEHIIV_PUBLICATION_ID
+   # - BEEHIIV_SYNC_BATCH_SIZE
+
    # Production-Only Env Database config
🧹 Nitpick comments (1)
server/apps/newsletter/tasks.py (1)

37-37: Consider using proper logging instead of print statements.

Replace print statements with proper logging to maintain better observability and consistency with production best practices.

-print(f"Error sending email to {subscriber.email}: {e}")
+logger.error(f"Error sending email to {subscriber.email}: {e}")

-print(f'Newsletter sent to {subscriber_count} subscribers')
+logger.info(f'Newsletter sent to {subscriber_count} subscribers')

Also applies to: 46-46

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b55bd47 and e614157.

📒 Files selected for processing (10)
  • README.md (1 hunks)
  • server/.env.example (1 hunks)
  • server/apps/newsletter/beehiiv.py (0 hunks)
  • server/apps/newsletter/migrations/0012_subscriber_beehiiv_id_subscriber_sync_error_and_more.py (0 hunks)
  • server/apps/newsletter/models.py (0 hunks)
  • server/apps/newsletter/tasks.py (3 hunks)
  • server/apps/research/urls.py (1 hunks)
  • server/core/celery.py (1 hunks)
  • server/core/config/beehiiv.py (0 hunks)
  • server/core/config/celery_config.py (0 hunks)
💤 Files with no reviewable changes (5)
  • server/apps/newsletter/models.py
  • server/apps/newsletter/migrations/0012_subscriber_beehiiv_id_subscriber_sync_error_and_more.py
  • server/core/config/beehiiv.py
  • server/apps/newsletter/beehiiv.py
  • server/core/config/celery_config.py
🔇 Additional comments (7)
server/core/celery.py (2)

30-30: LGTM! Schedule configuration is properly maintained.

The remaining Celery beat tasks for article publishing and newsletter sending are correctly configured with their minute-based schedules.

Also applies to: 35-35


43-43: LGTM! Debug task formatting is correct.

The debug print statement is properly formatted.

server/apps/research/urls.py (3)

15-15: LGTM! Comments improve code clarity.

The added comments clearly explain the purpose of each URL pattern.

Also applies to: 17-18


21-24: LGTM! Article retrieval endpoint is well-defined.

The endpoint for retrieving articles by identifier (slug or UUID) is properly implemented with clear comments.


25-29: LGTM! New endpoints enhance functionality.

The new endpoints for category-based article retrieval, TinyMCE image upload, and RSS feed are well-structured and properly documented.

server/apps/newsletter/tasks.py (1)

19-24: LGTM! Unsubscribe link generation is correct.

The unsubscribe link is properly generated using the site URL and subscriber email.

server/.env.example (1)

32-32: LGTM! Environment configuration is properly maintained.

The removal of Beehiiv-related environment variables is consistent with the PR objective, and the remaining configuration is well-documented.

Let's verify that all Beehiiv references have been removed from the codebase:

@@ -213,7 +207,7 @@ Before running the application, ensure you have the following:
python3 manage.py migrate # To migrate the changes in Database
python3 manage.py runserver # To run the API server
redis-server # to start redis-server
celery -A core worker -Q default,beehiiv -l info # to run celery with beehiiv queue
celery -A core worker -l info # to run celery
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Incomplete removal of Beehiiv integration detected

The Celery worker command change in README.md is correct, but there are remaining Beehiiv references that need to be removed:

  • server/apps/newsletter/views.py:
    • Remove the import from .tasks import sync_subscriber_to_beehiiv
    • Remove the task call sync_subscriber_to_beehiiv.delay(subscriber.id)
    • Remove the related log message
🔗 Analysis chain

Verify Celery worker configuration.

The Celery worker command has been simplified by removing the -Q default,beehiiv queue configuration, which aligns with the removal of Beehiiv integration.

Run this script to ensure no remaining Beehiiv-related Celery tasks exist:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining Beehiiv-related Celery tasks
# that might need the beehiiv queue.

# Search for any remaining Beehiiv-related task definitions
rg -i "beehiiv.*task" 

# Search for any remaining queue configurations
rg -i "queue.*beehiiv"

Length of output: 48


Script:

#!/bin/bash
# Broader search for any Beehiiv references
echo "=== Searching for any Beehiiv references ==="
rg -i "beehiiv"

# Look for Celery configuration files and task definitions
echo -e "\n=== Checking Celery configurations ==="
fd -e py -e ini -e conf -e cfg | grep -i "celery"

# Search for queue configurations in Python files
echo -e "\n=== Checking queue configurations ==="
rg "queue.*=" "\.py$"

Length of output: 770


Script:

#!/bin/bash
# Check the content of newsletter views and tasks
echo "=== Newsletter Views Content ==="
cat server/apps/newsletter/views.py

echo -e "\n=== Celery Configuration Files ==="
echo "--- core/celery.py ---"
cat server/core/celery.py
echo -e "\n--- core/config/celery_config.py ---"
cat server/core/config/celery_config.py

Length of output: 3677

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.

1 participant