[MM-15274] Migrate "Team.Get" to Sync by default (#10694)

* Migrate Team.Get to Sync by default

* change parseRange return value to ok

* fix formatting

* remove err checks

* use require.nil

* require nil
Этот коммит содержится в:
tengis b
2019-04-27 01:18:07 +09:00
коммит произвёл Jesús Espino
родитель 2f237d68b7
Коммит 8252eab5da
14 изменённых файлов: 115 добавлений и 98 удалений

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

@@ -398,9 +398,8 @@ func (s *SqlSupplier) GroupCreateGroupSyncable(ctx context.Context, groupSyncabl
switch groupSyncable.Type {
case model.GroupSyncableTypeTeam:
teamResult := <-s.Team().Get(groupSyncable.SyncableId)
if teamResult.Err != nil {
result.Err = teamResult.Err
if _, err := s.Team().Get(groupSyncable.SyncableId); err != nil {
result.Err = err
return result
}

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

@@ -238,22 +238,16 @@ func (s SqlTeamStore) UpdateDisplayName(name string, teamId string) store.StoreC
})
}
func (s SqlTeamStore) Get(id string) store.StoreChannel {
return store.Do(func(result *store.StoreResult) {
obj, err := s.GetReplica().Get(model.Team{}, id)
if err != nil {
result.Err = model.NewAppError("SqlTeamStore.Get", "store.sql_team.get.finding.app_error", nil, "id="+id+", "+err.Error(), http.StatusInternalServerError)
return
}
if obj == nil {
result.Err = model.NewAppError("SqlTeamStore.Get", "store.sql_team.get.find.app_error", nil, "id="+id, http.StatusNotFound)
return
}
func (s SqlTeamStore) Get(id string) (*model.Team, *model.AppError) {
obj, err := s.GetReplica().Get(model.Team{}, id)
if err != nil {
return nil, model.NewAppError("SqlTeamStore.Get", "store.sql_team.get.finding.app_error", nil, "id="+id+", "+err.Error(), http.StatusInternalServerError)
}
if obj == nil {
return nil, model.NewAppError("SqlTeamStore.Get", "store.sql_team.get.find.app_error", nil, "id="+id, http.StatusNotFound)
}
team := obj.(*model.Team)
result.Data = team
})
return obj.(*model.Team), nil
}
func (s SqlTeamStore) GetByInviteId(inviteId string) store.StoreChannel {