From 908ed5555f8a3d37cd057035b2792d66c8b7838a Mon Sep 17 00:00:00 2001 From: Carlos Tadeu Panato Junior Date: Sat, 13 Oct 2018 12:35:57 +0200 Subject: [APIv4] add getChannelMembersTimezone (#9286) * add getChannelMembersTimezone * update per feedback review * add delimeter to error --- model/utils.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'model/utils.go') diff --git a/model/utils.go b/model/utils.go index 172b78242..849e529c1 100644 --- a/model/utils.go +++ b/model/utils.go @@ -564,3 +564,26 @@ func IsDomainName(s string) bool { return ok } + +func RemoveDuplicateStrings(in []string) []string { + out := []string{} + seen := make(map[string]bool, len(in)) + + for _, item := range in { + if !seen[item] { + out = append(out, item) + + seen[item] = true + } + } + + return out +} + +func GetPreferredTimezone(timezone StringMap) string { + if timezone["useAutomaticTimezone"] == "true" { + return timezone["automaticTimezone"] + } + + return timezone["manualTimezone"] +} -- cgit v1.2.3-1-g7c22