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 validation to prevent self-referrals #47

Merged
merged 1 commit into from
Jan 7, 2025
Merged

Conversation

JamesChevalier
Copy link
Contributor

Pull Request

Summary:

Adds a validation on Referral which blocks self-referrals

Related Issue:

Discussion #46

Description:

This fixes the existing situation which allows self-referrals:

user = User.first
referral_code = user.referral_codes.create
Refer.refer(code: referral_code.code, referee: user)

Testing:

Added test to ensure that the count of Referrals does not increase if both the referrer and referee are the same.

Screenshots (if applicable):

Checklist:

  • Code follows the project's coding standards
  • Tests have been added or updated to cover the changes
  • Documentation has been updated (if applicable)
  • All existing tests pass
  • Conforms to the contributing guidelines

Additional Notes:

@excid3 excid3 merged commit e42f431 into excid3:main Jan 7, 2025
@excid3
Copy link
Owner

excid3 commented Jan 7, 2025

This is great, thanks @JamesChevalier! 🎉

@excid3
Copy link
Owner

excid3 commented Jan 7, 2025

Released in 1.0.2

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