* Cleanup model/utils.go

- Removed some functions which were unsued. (The unused linter was somehow failing to catch this).
- Moved some functions inside other packages.
- Removed two duplicate instances of the same function - RemoveDuplicateStrings and UniqueStrings.
- Moved some regexes to global vars to prevent compilation every time.

```release-note
NONE
```

* fix lint

```release-note
NONE
```

* bring back unused exception

```release-note
NONE
```

* fix tests

```release-note
NONE
```

* Address review comments

```release-note
NONE
```
Этот коммит содержится в:
Agniva De Sarker
2021-07-21 13:15:29 +05:30
коммит произвёл Claudio Costa
родитель 77f9620997
Коммит 7454680be5
11 изменённых файлов: 182 добавлений и 231 удалений

Просмотреть файл

@@ -931,30 +931,6 @@ func CleanUsername(username string) string {
return s
}
func IsValidUserNotifyLevel(notifyLevel string) bool {
return notifyLevel == ChannelNotifyAll ||
notifyLevel == ChannelNotifyMention ||
notifyLevel == ChannelNotifyNone
}
func IsValidPushStatusNotifyLevel(notifyLevel string) bool {
return notifyLevel == StatusOnline ||
notifyLevel == StatusAway ||
notifyLevel == StatusOffline
}
func IsValidCommentsNotifyLevel(notifyLevel string) bool {
return notifyLevel == CommentsNotifyAny ||
notifyLevel == CommentsNotifyRoot ||
notifyLevel == CommentsNotifyNever
}
func IsValidEmailBatchingInterval(emailInterval string) bool {
return emailInterval == PreferenceEmailIntervalImmediately ||
emailInterval == PreferenceEmailIntervalFifteen ||
emailInterval == PreferenceEmailIntervalHour
}
func IsValidLocale(locale string) bool {
if locale != "" {
if len(locale) > UserLocaleMaxLength {