Skip to content

Commit 4aa48b3

Browse files
authored
Merge pull request #207 from traggo/fallback-setting
fix: crash on prevously set settings
2 parents 6255a2f + 5c0d589 commit 4aa48b3

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

setting/usersettings.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ func toInternalWeekday(weekday gqlmodel.WeekDay) time.Weekday {
119119
func toExternalDateTimeInputStyle(style string) gqlmodel.DateTimeInputStyle {
120120
switch style {
121121
case model.DateTimeInputFancy:
122-
return model.DateTimeInputFancy
122+
return gqlmodel.DateTimeInputStyleFancy
123123
case model.DateTimeInputNative:
124-
return model.DateTimeInputNative
124+
return gqlmodel.DateTimeInputStyleNative
125125
default:
126-
panic("unknown datetime input style")
126+
return gqlmodel.DateTimeInputStyleFancy
127127
}
128128
}
129129

@@ -134,6 +134,6 @@ func toInternalDateTimeInputStyle(style gqlmodel.DateTimeInputStyle) string {
134134
case gqlmodel.DateTimeInputStyleNative:
135135
return model.DateTimeInputNative
136136
default:
137-
panic("unknown datetime input style")
137+
return model.DateTimeInputFancy
138138
}
139139
}

setting/usersettings_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,7 @@ func TestShouldHandleInvalidInputs(t *testing.T) {
6262
toInternalTheme("aoeuaoeu")
6363
toExternalDateLocale("aeu")
6464
toInternalDateLocale("aoeu")
65+
toExternalDateTimeInputStyle("aoeu")
66+
toInternalDateTimeInputStyle("aoeu")
6567

6668
}

0 commit comments

Comments
 (0)