Skip to content

Commit a651457

Browse files
authored
Ensure Kazakhstan isn't captured in Russia sanction checks (#57)
1 parent 85a1f59 commit a651457

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

pkg/code/antispam/phone.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@ import "strings"
55
// todo: Put in a DB somehwere? Or make configurable?
66
// todo: Needs tests
77
func hasBannedPhoneNumberPrefix(phoneNumber string) bool {
8-
for _, prefix := range []string{
9-
// Sanctioned countries
10-
//
11-
// todo: Probably doesn't belong in an antispam package, but it's just a
12-
// convenient place for now
8+
// Check that a +7 phone number is not a mobile number from Kazakhstan
9+
if strings.HasPrefix("+770", phoneNumber) || strings.HasPrefix("+777", phoneNumber) {
10+
return false
11+
}
1312

13+
// Sanctioned countries
14+
//
15+
// todo: Probably doesn't belong in an antispam package, but it's just a
16+
// convenient place for now
17+
for _, prefix := range []string{
1418
"+7", // Russia
1519
"+30", // Greece (Balkans)
1620
"+40", // Romania (Balkans)

0 commit comments

Comments
 (0)