Chat country flags: stop at first subdivision
This commit is contained in:
parent
bf71ed421c
commit
73f89c7837
|
@ -83,7 +83,12 @@ func GetChatFlagEmoji(r *http.Request) (string, error) {
|
|||
|
||||
// Subdivisions (states)
|
||||
if len(city.Subdivisions) > 0 {
|
||||
for _, sub := range city.Subdivisions {
|
||||
// Stop at just one subdivision. This will be US states
|
||||
// and general regions, but without getting too specific
|
||||
// for UK users especially where the subdivisions can hone
|
||||
// in on their city of 1,000 population!
|
||||
sub := city.Subdivisions[0]
|
||||
|
||||
// Can we get its name?
|
||||
if name, ok := sub.Names["en"]; ok {
|
||||
flags = append(flags, name)
|
||||
|
@ -91,7 +96,6 @@ func GetChatFlagEmoji(r *http.Request) (string, error) {
|
|||
flags = append(flags, sub.IsoCode)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return emoji + " " + strings.Join(flags, ", "), nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user