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

Add twitter_id filed to TwitterConnection #612

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

PooyaFekri
Copy link
Collaborator

@PooyaFekri PooyaFekri commented Aug 30, 2024

Summary by Sourcery

Add a 'twitter_id' field to the TwitterConnection model and update the save logic to include this field. Modify the is_connected method to use twitter_id for connection status. Handle potential IntegrityError during save operation to provide a user-friendly error message.

New Features:

  • Add a new field 'twitter_id' to the TwitterConnection model to store the unique Twitter ID for each connection.

Enhancements:

  • Update the TwitterConnection model's is_connected method to check for the presence of twitter_id instead of access tokens.

@PooyaFekri PooyaFekri merged commit 14f3971 into develop Aug 30, 2024
Copy link
Contributor

sourcery-ai bot commented Aug 30, 2024

Reviewer's Guide by Sourcery

This pull request adds a 'twitter_id' field to the TwitterConnection model and updates related functionality. The changes include modifying the model, updating the view to handle the new field, and creating a migration for the database schema change.

File-Level Changes

Change Details Files
Add 'twitter_id' field to TwitterConnection model
  • Add 'twitter_id' CharField to TwitterConnection model
  • Create migration file for the new 'twitter_id' field
  • Update 'is_connected' method to check 'twitter_id' instead of access tokens
  • Change 'twitter_id' property to 'get_twitter_id' method
authentication/models.py
authentication/migrations/0042_twitterconnection_twitter_id.py
Update TwitterConnection save process in view
  • Add 'twitter_id' to update_fields in save method
  • Implement error handling for IntegrityError
  • Raise ValidationError with custom message for duplicate connections
authentication/views.py

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @PooyaFekri - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The change in the 'is_connected' method to only check for 'twitter_id' might be a breaking change. Please ensure that this doesn't affect existing functionality and consider adding a deprecation warning if necessary.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

Comment on lines +748 to +750
raise ValidationError(
"""We can not connect you twitter account,
may be your account is connected before"""
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Improve the error message for better user experience

Consider rephrasing the error message to be more user-friendly and fixing the typo. Also, ensure proper indentation for multiline strings.

            raise ValidationError(
                "Unable to connect your Twitter account. "
                "This account may have been connected previously."
            )

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