Compare commits

..

No commits in common. "46edf2b819a250043d2c7fa99deafd6c34bcbd3c" and "235af3519dd4c0921943332ea7469930a59e3e3d" have entirely different histories.

3 changed files with 24 additions and 25 deletions

View File

@ -69,15 +69,15 @@ func (fm *FlagManager) GetFlag(label string) (uint32, error) {
} }
type Handlers struct { type Handlers struct {
pe *persist.Persister pe *persist.Persister
st *state.State st *state.State
ca cache.Memory ca cache.Memory
userdataStore common.DataStore userdataStore common.DataStore
adminstore *utils.AdminStore adminstore *utils.AdminStore
flagManager *asm.FlagParser flagManager *asm.FlagParser
accountService remote.AccountServiceInterface accountService remote.AccountServiceInterface
prefixDb storage.PrefixDb prefixDb storage.PrefixDb
profile *models.Profile profile *models.Profile
ReplaceSeparatorFunc func(string) string ReplaceSeparatorFunc func(string) string
} }
@ -94,12 +94,12 @@ func NewHandlers(appFlags *asm.FlagParser, userdataStore db.Db, adminstore *util
prefixDb := storage.NewSubPrefixDb(userdataStore, prefix) prefixDb := storage.NewSubPrefixDb(userdataStore, prefix)
h := &Handlers{ h := &Handlers{
userdataStore: userDb, userdataStore: userDb,
flagManager: appFlags, flagManager: appFlags,
adminstore: adminstore, adminstore: adminstore,
accountService: accountService, accountService: accountService,
prefixDb: prefixDb, prefixDb: prefixDb,
profile: &models.Profile{Max: 6}, profile: &models.Profile{Max: 6},
ReplaceSeparatorFunc: replaceSeparatorFunc, ReplaceSeparatorFunc: replaceSeparatorFunc,
} }
return h, nil return h, nil
@ -1986,16 +1986,15 @@ func (h *Handlers) insertProfileItems(ctx context.Context, sessionId string, res
for index, profileItem := range h.profile.ProfileItems { for index, profileItem := range h.profile.ProfileItems {
// Ensure the profileItem is not "0"(is set) // Ensure the profileItem is not "0"(is set)
if profileItem != "0" { if profileItem != "0" {
flag, _ := h.flagManager.GetFlag(profileFlagNames[index]) err = store.WriteEntry(ctx, sessionId, profileDataKeys[index], []byte(profileItem))
isProfileItemSet := h.st.MatchFlag(flag, true) if err != nil {
if !isProfileItemSet { logg.ErrorCtxf(ctx, "failed to write profile entry with", "key", profileDataKeys[index], "value", profileItem, "error", err)
err = store.WriteEntry(ctx, sessionId, profileDataKeys[index], []byte(profileItem)) return err
if err != nil {
logg.ErrorCtxf(ctx, "failed to write profile entry with", "key", profileDataKeys[index], "value", profileItem, "error", err)
return err
}
res.FlagSet = append(res.FlagSet, flag)
} }
// Get the flag for the current index
flag, _ := h.flagManager.GetFlag(profileFlagNames[index])
res.FlagSet = append(res.FlagSet, flag)
} }
} }
return nil return nil

View File

@ -10,4 +10,5 @@ CATCH _ flag_back_set 1
RELOAD save_offerings RELOAD save_offerings
INCMP _ 0 INCMP _ 0
CATCH pin_entry flag_offerings_set 1 CATCH pin_entry flag_offerings_set 1
CATCH pin_entry flag_offerings_set 0
INCMP update_profile_items * INCMP update_profile_items *

View File

@ -11,4 +11,3 @@ INCMP _ 0
INCMP set_male 1 INCMP set_male 1
INCMP set_female 2 INCMP set_female 2
INCMP set_unspecified 3 INCMP set_unspecified 3
INCMP . *