Compare commits
No commits in common. "0a7152d6b8f2dfa8942119e7059de50c79446fd0" and "acfb6c1d76863639bf468a8887d2edd2364e9703" have entirely different histories.
0a7152d6b8
...
acfb6c1d76
@ -2187,23 +2187,6 @@ func (h *MenuHandlers) resetIncorrectPINAttempts(ctx context.Context, sessionId
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *MenuHandlers) persistInitialLanguageCode(ctx context.Context, sessionId string, code string) error {
|
|
||||||
store := h.userdataStore
|
|
||||||
_, err := store.ReadEntry(ctx, sessionId, storedb.DATA_INITIAL_LANGUAGE_CODE)
|
|
||||||
if err == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
if !db.IsNotFound(err) {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
err = store.WriteEntry(ctx, sessionId, storedb.DATA_INITIAL_LANGUAGE_CODE, []byte(code))
|
|
||||||
if err != nil {
|
|
||||||
logg.ErrorCtxf(ctx, "failed to persist initial language code", "key", storedb.DATA_INITIAL_LANGUAGE_CODE, "value", code, "error", err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// persistLanguageCode persists the selected ISO 639 language code
|
// persistLanguageCode persists the selected ISO 639 language code
|
||||||
func (h *MenuHandlers) persistLanguageCode(ctx context.Context, code string) error {
|
func (h *MenuHandlers) persistLanguageCode(ctx context.Context, code string) error {
|
||||||
store := h.userdataStore
|
store := h.userdataStore
|
||||||
@ -2216,5 +2199,5 @@ func (h *MenuHandlers) persistLanguageCode(ctx context.Context, code string) err
|
|||||||
logg.ErrorCtxf(ctx, "failed to persist language code", "key", storedb.DATA_SELECTED_LANGUAGE_CODE, "value", code, "error", err)
|
logg.ErrorCtxf(ctx, "failed to persist language code", "key", storedb.DATA_SELECTED_LANGUAGE_CODE, "value", code, "error", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return h.persistInitialLanguageCode(ctx, sessionId, code)
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -825,17 +825,6 @@ func TestSetLanguage(t *testing.T) {
|
|||||||
|
|
||||||
// Assert that the Result FlagSet has the required flags after language switch
|
// Assert that the Result FlagSet has the required flags after language switch
|
||||||
assert.Equal(t, res, tt.expectedResult, "Result should match expected result")
|
assert.Equal(t, res, tt.expectedResult, "Result should match expected result")
|
||||||
code, err := store.ReadEntry(ctx, sessionId, storedb.DATA_SELECTED_LANGUAGE_CODE)
|
|
||||||
if err != nil {
|
|
||||||
t.Error(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.Equal(t, string(code), tt.expectedResult.Content)
|
|
||||||
code, err = store.ReadEntry(ctx, sessionId, storedb.DATA_INITIAL_LANGUAGE_CODE)
|
|
||||||
if err != nil {
|
|
||||||
t.Error(err)
|
|
||||||
}
|
|
||||||
assert.Equal(t, string(code), "eng")
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,8 +59,6 @@ const (
|
|||||||
DATA_INCORRECT_PIN_ATTEMPTS
|
DATA_INCORRECT_PIN_ATTEMPTS
|
||||||
//ISO 639 code for the selected language.
|
//ISO 639 code for the selected language.
|
||||||
DATA_SELECTED_LANGUAGE_CODE
|
DATA_SELECTED_LANGUAGE_CODE
|
||||||
//ISO 639 code for the language initially selected.
|
|
||||||
DATA_INITIAL_LANGUAGE_CODE
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user