Compare commits
3 Commits
83a10efcd9
...
c9678df152
Author | SHA1 | Date | |
---|---|---|---|
c9678df152 | |||
c37fee5e54 | |||
98b2a31655 |
@ -601,16 +601,20 @@ func (h *MenuHandlers) ValidateBlockedNumber(ctx context.Context, sym string, in
|
||||
return res, fmt.Errorf("missing session")
|
||||
}
|
||||
|
||||
if h.st.Back() {
|
||||
if string(input) == "0" {
|
||||
res.FlagReset = append(res.FlagReset, flag_unregistered_number)
|
||||
return res, nil
|
||||
}
|
||||
|
||||
blockedNumber := string(input)
|
||||
_, err = store.ReadEntry(ctx, blockedNumber, storedb.DATA_PUBLIC_KEY)
|
||||
if !phone.IsValidPhoneNumber(blockedNumber) {
|
||||
formattedNumber, err := phone.FormatPhoneNumber(blockedNumber)
|
||||
if err != nil {
|
||||
res.FlagSet = append(res.FlagSet, flag_unregistered_number)
|
||||
logg.ErrorCtxf(ctx, "Failed to format the phone number: %s", blockedNumber, "error", err)
|
||||
return res, nil
|
||||
}
|
||||
|
||||
_, err = store.ReadEntry(ctx, formattedNumber, storedb.DATA_PUBLIC_KEY)
|
||||
if err != nil {
|
||||
if db.IsNotFound(err) {
|
||||
logg.InfoCtxf(ctx, "Invalid or unregistered number")
|
||||
@ -621,7 +625,7 @@ func (h *MenuHandlers) ValidateBlockedNumber(ctx context.Context, sym string, in
|
||||
return res, err
|
||||
}
|
||||
}
|
||||
err = store.WriteEntry(ctx, sessionId, storedb.DATA_BLOCKED_NUMBER, []byte(blockedNumber))
|
||||
err = store.WriteEntry(ctx, sessionId, storedb.DATA_BLOCKED_NUMBER, []byte(formattedNumber))
|
||||
if err != nil {
|
||||
return res, nil
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ var (
|
||||
sessionID string
|
||||
src = rand.NewSource(42)
|
||||
g = rand.New(src)
|
||||
secondarySessionId = "0700000000"
|
||||
secondarySessionId = "+254700000000"
|
||||
)
|
||||
|
||||
var groupTestFile = flag.String("test-file", "group_test.json", "The test file to use for running the group tests")
|
||||
|
@ -1,4 +1,4 @@
|
||||
CATCH no_admin_privilege flag_admin_privilege 0
|
||||
CATCH no_admin_privilege flag_admin_privilege 0
|
||||
LOAD reset_account_authorized 0
|
||||
RELOAD reset_account_authorized
|
||||
MOUT back 0
|
||||
|
Loading…
Reference in New Issue
Block a user