[MM-10768] Migrate "Channel.SaveDirectChannel" to Sync by default (#10846)

Этот коммит содержится в:
Shota Gvinepadze
2019-05-17 00:04:58 +04:00
коммит произвёл Hanzei
родитель 2d3e417833
Коммит fab2e349b3
10 изменённых файлов: 139 добавлений и 120 удалений

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

@@ -340,16 +340,14 @@ func (a *App) createDirectChannel(userId string, otherUserId string) (*model.Cha
return nil, model.NewAppError("CreateDirectChannel", "api.channel.create_direct_channel.invalid_user.app_error", nil, otherUserId, http.StatusBadRequest)
}
result := <-a.Srv.Store.Channel().CreateDirectChannel(userId, otherUserId)
if result.Err != nil {
if result.Err.Id == store.CHANNEL_EXISTS_ERROR {
return result.Data.(*model.Channel), result.Err
channel, err := a.Srv.Store.Channel().CreateDirectChannel(userId, otherUserId)
if err != nil {
if err.Id == store.CHANNEL_EXISTS_ERROR {
return channel, err
}
return nil, result.Err
return nil, err
}
channel := result.Data.(*model.Channel)
if result := <-a.Srv.Store.ChannelMemberHistory().LogJoinEvent(userId, channel.Id, model.GetMillis()); result.Err != nil {
mlog.Warn(fmt.Sprintf("Failed to update ChannelMemberHistory table %v", result.Err))
}

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

@@ -56,9 +56,9 @@ func (a *App) BulkImport(fileReader io.Reader, dryRun bool, workers int) (*model
}
if lineNumber == 1 {
importDataFileVersion, apperr := processImportDataFileVersionLine(line)
if apperr != nil {
return apperr, lineNumber
importDataFileVersion, appErr := processImportDataFileVersionLine(line)
if appErr != nil {
return appErr, lineNumber
}
if importDataFileVersion != 1 {

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

@@ -1136,8 +1136,8 @@ func (a *App) ImportDirectChannel(data *DirectChannelImportData, dryRun bool) *m
if data.Header != nil {
channel.Header = *data.Header
if _, apperr := a.Srv.Store.Channel().Update(channel); apperr != nil {
return model.NewAppError("BulkImport", "app.import.import_direct_channel.update_header_failed.error", nil, apperr.Error(), http.StatusBadRequest)
if _, appErr := a.Srv.Store.Channel().Update(channel); appErr != nil {
return model.NewAppError("BulkImport", "app.import.import_direct_channel.update_header_failed.error", nil, appErr.Error(), http.StatusBadRequest)
}
}