Created
November 21, 2017 14:46
-
-
Save bogdan/2c1211ccc3d592adc678d5bcdfa8b359 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% assign is_self_referral_by_email = false %} | |
{% if advocate_info.email != blank and friend_info.email != blank %} | |
{% assign is_similar = advocate_info.email | similar_to_email: friend_info.email %} | |
{% assign plus_in_fr_email = friend_info.email | regexp_captures: '(\+[\d\w]+)?\@' %} | |
{% assign plus_in_ad_email = advocate_info.email | regexp_captures: '(\+[\d\w]+)?\@' %} | |
{% assign fr_email = friend_info.email | remove: plus_in_fr_email[0] %} | |
{% assign ad_email = advocate_info.email | remove: plus_in_ad_email[0] %} | |
{% if fr_email != blank and ad_email != blank %} | |
{% if is_similar or fr_email == ad_email %} | |
{% assign is_self_referral = true %} | |
{% assign is_self_referral_by_email = true %} | |
{% endif %} | |
{% endif %} | |
{% endif %} | |
{% assign is_detect_by_fingerprint = false %} | |
{% if friend_custom_properties.fp_hash != blank and friend_custom_properties.fp_hash == advocate_custom_properties.fp_hash %} | |
{% assign is_detect_by_fingerprint = true %} | |
{% endif %} | |
{% assign is_detect_by_facebook_id = false %} | |
{% if friend_custom_properties.fb_id != blank and friend_custom_properties.fb_id == advocate_custom_properties.fb_id %} | |
{% assign is_detect_by_facebook_id = true %} | |
{% endif %} | |
{% assign is_self_referral_by_ip = false %} | |
{% if advocate_origin.ip.address and friend_offer.ip.address and advocate_origin.ip.address == friend_offer.ip.address %} | |
{% assign is_self_referral_by_ip = true %} | |
{% endif %} | |
{% if is_detect_by_fingerprint %} | |
block by fingerprint | |
{% elsif is_detect_by_facebook_id %} | |
block by facebook id | |
{% elsif is_self_referral_by_ip %} | |
block by IP | |
{% elsif is_self_referral_by_email %} | |
block similar email | |
{% else %} | |
true | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment