MM-31064: Simplify indentation (#16565)
* MM-31064: Simplify indentation Reduce indentation where possible. ```release-note NONE ``` Command ran to verify: golangci-lint run --disable-all --enable golint --max-issues-per-linter=10000 --max-same-issues=100000 ./... | grep "block ends with a return state" https://mattermost.atlassian.net/browse/MM-31064 * incorporate review comments * enable golint for outdent rule * fix remaining issues Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
7419898449
Коммит
1a131b54af
@@ -72,9 +72,8 @@ func FileInfoFromJson(data io.Reader) *FileInfo {
|
||||
var fi FileInfo
|
||||
if err := decoder.Decode(&fi); err != nil {
|
||||
return nil
|
||||
} else {
|
||||
return &fi
|
||||
}
|
||||
return &fi
|
||||
}
|
||||
|
||||
func FileInfosToJson(infos []*FileInfo) string {
|
||||
@@ -88,9 +87,8 @@ func FileInfosFromJson(data io.Reader) []*FileInfo {
|
||||
var infos []*FileInfo
|
||||
if err := decoder.Decode(&infos); err != nil {
|
||||
return nil
|
||||
} else {
|
||||
return infos
|
||||
}
|
||||
return infos
|
||||
}
|
||||
|
||||
func (fi *FileInfo) PreSave() {
|
||||
@@ -196,13 +194,13 @@ func GetInfoForBytes(name string, data io.ReadSeeker, size int) (*FileInfo, *App
|
||||
if info.MimeType == "image/gif" {
|
||||
// Just show the gif itself instead of a preview image for animated gifs
|
||||
data.Seek(0, io.SeekStart)
|
||||
if gifConfig, err := gif.DecodeAll(data); err != nil {
|
||||
gifConfig, err := gif.DecodeAll(data)
|
||||
if err != nil {
|
||||
// Still return the rest of the info even though it doesn't appear to be an actual gif
|
||||
info.HasPreviewImage = true
|
||||
return info, NewAppError("GetInfoForBytes", "model.file_info.get.gif.app_error", nil, err.Error(), http.StatusBadRequest)
|
||||
} else {
|
||||
info.HasPreviewImage = len(gifConfig.Image) == 1
|
||||
}
|
||||
info.HasPreviewImage = len(gifConfig.Image) == 1
|
||||
} else {
|
||||
info.HasPreviewImage = true
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user