Merge pull request 'debug-errors-with-temporary-value' (#22) from debug-errors-with-temporary-value into master
Some checks are pending
release / docker (push) Waiting to run
Some checks are pending
release / docker (push) Waiting to run
Reviewed-on: #22
This commit is contained in:
commit
fd84f6ae98
@ -488,13 +488,6 @@ func (h *MenuHandlers) ConfirmPinChange(ctx context.Context, sym string, input [
|
||||
return res, err
|
||||
}
|
||||
|
||||
// clear the temporary value as it has been used
|
||||
err = store.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(""))
|
||||
if err != nil {
|
||||
logg.ErrorCtxf(ctx, "failed to clear DATA_TEMPORARY_VALUE entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", "empty", "error", err)
|
||||
return res, err
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
@ -535,13 +528,6 @@ func (h *MenuHandlers) ResetOthersPin(ctx context.Context, sym string, input []b
|
||||
return res, err
|
||||
}
|
||||
|
||||
// clear the temporary value as it has been used
|
||||
err = store.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(""))
|
||||
if err != nil {
|
||||
logg.ErrorCtxf(ctx, "failed to clear DATA_TEMPORARY_VALUE entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", "empty", "error", err)
|
||||
return res, err
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
@ -717,12 +703,6 @@ func (h *MenuHandlers) SaveFirstname(ctx context.Context, sym string, input []by
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
// clear the temporary value as it has been used
|
||||
err = store.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(""))
|
||||
if err != nil {
|
||||
logg.ErrorCtxf(ctx, "failed to clear DATA_TEMPORARY_VALUE entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", "empty", "error", err)
|
||||
return res, err
|
||||
}
|
||||
res.FlagSet = append(res.FlagSet, flag_firstname_set)
|
||||
} else {
|
||||
if firstNameSet {
|
||||
@ -767,12 +747,6 @@ func (h *MenuHandlers) SaveFamilyname(ctx context.Context, sym string, input []b
|
||||
logg.ErrorCtxf(ctx, "failed to write familyName entry with", "key", storedb.DATA_FAMILY_NAME, "value", temporaryFamilyName, "error", err)
|
||||
return res, err
|
||||
}
|
||||
// clear the temporary value as it has been used
|
||||
err = store.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(""))
|
||||
if err != nil {
|
||||
logg.ErrorCtxf(ctx, "failed to clear DATA_TEMPORARY_VALUE entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", "empty", "error", err)
|
||||
return res, err
|
||||
}
|
||||
res.FlagSet = append(res.FlagSet, flag_familyname_set)
|
||||
} else {
|
||||
if familyNameSet {
|
||||
@ -847,12 +821,6 @@ func (h *MenuHandlers) SaveYob(ctx context.Context, sym string, input []byte) (r
|
||||
logg.ErrorCtxf(ctx, "failed to write yob entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", temporaryYob, "error", err)
|
||||
return res, err
|
||||
}
|
||||
// clear the temporary value as it has been used
|
||||
err = store.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(""))
|
||||
if err != nil {
|
||||
logg.ErrorCtxf(ctx, "failed to clear DATA_TEMPORARY_VALUE entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", "empty", "error", err)
|
||||
return res, err
|
||||
}
|
||||
res.FlagSet = append(res.FlagSet, flag_yob_set)
|
||||
} else {
|
||||
if yobSet {
|
||||
@ -896,12 +864,6 @@ func (h *MenuHandlers) SaveLocation(ctx context.Context, sym string, input []byt
|
||||
logg.ErrorCtxf(ctx, "failed to write location entry with", "key", storedb.DATA_LOCATION, "value", temporaryLocation, "error", err)
|
||||
return res, err
|
||||
}
|
||||
// clear the temporary value as it has been used
|
||||
err = store.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(""))
|
||||
if err != nil {
|
||||
logg.ErrorCtxf(ctx, "failed to clear DATA_TEMPORARY_VALUE entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", "empty", "error", err)
|
||||
return res, err
|
||||
}
|
||||
res.FlagSet = append(res.FlagSet, flag_location_set)
|
||||
} else {
|
||||
if locationSet {
|
||||
@ -947,12 +909,6 @@ func (h *MenuHandlers) SaveGender(ctx context.Context, sym string, input []byte)
|
||||
logg.ErrorCtxf(ctx, "failed to write gender entry with", "key", storedb.DATA_GENDER, "value", gender, "error", err)
|
||||
return res, err
|
||||
}
|
||||
// clear the temporary value as it has been used
|
||||
err = store.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(""))
|
||||
if err != nil {
|
||||
logg.ErrorCtxf(ctx, "failed to clear DATA_TEMPORARY_VALUE entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", "empty", "error", err)
|
||||
return res, err
|
||||
}
|
||||
res.FlagSet = append(res.FlagSet, flag_gender_set)
|
||||
} else {
|
||||
if genderSet {
|
||||
@ -998,12 +954,6 @@ func (h *MenuHandlers) SaveOfferings(ctx context.Context, sym string, input []by
|
||||
logg.ErrorCtxf(ctx, "failed to write offerings entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", offerings, "error", err)
|
||||
return res, err
|
||||
}
|
||||
// clear the temporary value as it has been used
|
||||
err = store.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(""))
|
||||
if err != nil {
|
||||
logg.ErrorCtxf(ctx, "failed to clear DATA_TEMPORARY_VALUE entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", "empty", "error", err)
|
||||
return res, err
|
||||
}
|
||||
res.FlagSet = append(res.FlagSet, flag_offerings_set)
|
||||
} else {
|
||||
if offeringsSet {
|
||||
@ -1684,12 +1634,6 @@ func (h *MenuHandlers) InviteValidRecipient(ctx context.Context, sym string, inp
|
||||
// res.Content = l.Get("Your invitation to %s to join Sarafu Network has been sent.", string(recipient))
|
||||
|
||||
res.Content = l.Get("Your invite request for %s to Sarafu Network failed. Please try again later.", string(recipient))
|
||||
// clear the temporary value as it has been used
|
||||
err := store.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(""))
|
||||
if err != nil {
|
||||
logg.ErrorCtxf(ctx, "failed to clear DATA_TEMPORARY_VALUE entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", "empty", "error", err)
|
||||
return res, err
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
@ -2438,3 +2382,20 @@ func (h *MenuHandlers) constructAccountAlias(ctx context.Context) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *MenuHandlers) ClearTemporaryValue(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||
var res resource.Result
|
||||
sessionId, ok := ctx.Value("SessionId").(string)
|
||||
if !ok {
|
||||
return res, fmt.Errorf("missing session")
|
||||
}
|
||||
userStore := h.userdataStore
|
||||
|
||||
// clear the temporary value at the start
|
||||
err := userStore.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(""))
|
||||
if err != nil {
|
||||
logg.ErrorCtxf(ctx, "failed to clear DATA_TEMPORARY_VALUE entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", "empty", "error", err)
|
||||
return res, err
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
@ -6,12 +6,11 @@ import (
|
||||
|
||||
"git.defalsify.org/vise.git/db"
|
||||
"git.defalsify.org/vise.git/engine"
|
||||
"git.defalsify.org/vise.git/logging"
|
||||
"git.defalsify.org/vise.git/persist"
|
||||
"git.defalsify.org/vise.git/resource"
|
||||
"git.defalsify.org/vise.git/logging"
|
||||
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-api/remote"
|
||||
// sarafu_engine "git.grassecon.net/grassrootseconomics/sarafu-vise/engine"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/handlers/application"
|
||||
)
|
||||
|
||||
@ -125,6 +124,7 @@ func (ls *LocalHandlerService) GetHandler(accountService remote.AccountService)
|
||||
ls.DbRs.AddLocalFunc("update_all_profile_items", appHandlers.UpdateAllProfileItems)
|
||||
ls.DbRs.AddLocalFunc("set_back", appHandlers.SetBack)
|
||||
ls.DbRs.AddLocalFunc("show_blocked_account", appHandlers.ShowBlockedAccount)
|
||||
ls.DbRs.AddLocalFunc("clear_temporary_value", appHandlers.ClearTemporaryValue)
|
||||
ls.first = appHandlers.Init
|
||||
|
||||
return appHandlers, nil
|
||||
|
@ -1,3 +1,5 @@
|
||||
LOAD clear_temporary_value 2
|
||||
RELOAD clear_temporary_value
|
||||
LOAD set_default_voucher 8
|
||||
RELOAD set_default_voucher
|
||||
LOAD check_vouchers 10
|
||||
|
@ -1,4 +1,3 @@
|
||||
LOAD confirm_pin_change 7
|
||||
LOAD set_back 6
|
||||
LOAD authorize_account 5
|
||||
LOAD reset_allow_update 4
|
||||
|
Loading…
Reference in New Issue
Block a user