[MM-15802] Migrate "Session.UpdateDeviceId" to Sync by default (#11017)

Этот коммит содержится в:
Bolarinwa Balogun
2019-06-03 10:16:50 -04:00
коммит произвёл Hanzei
родитель 201fb5a717
Коммит 4cfe61393b
5 изменённых файлов: 33 добавлений и 25 удалений

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

@@ -196,14 +196,14 @@ func (me SqlSessionStore) UpdateRoles(userId, roles string) store.StoreChannel {
})
}
func (me SqlSessionStore) UpdateDeviceId(id string, deviceId string, expiresAt int64) store.StoreChannel {
return store.Do(func(result *store.StoreResult) {
if _, err := me.GetMaster().Exec("UPDATE Sessions SET DeviceId = :DeviceId, ExpiresAt = :ExpiresAt WHERE Id = :Id", map[string]interface{}{"DeviceId": deviceId, "Id": id, "ExpiresAt": expiresAt}); err != nil {
result.Err = model.NewAppError("SqlSessionStore.UpdateDeviceId", "store.sql_session.update_device_id.app_error", nil, err.Error(), http.StatusInternalServerError)
} else {
result.Data = deviceId
}
})
func (me SqlSessionStore) UpdateDeviceId(id string, deviceId string, expiresAt int64) (string, *model.AppError) {
query := "UPDATE Sessions SET DeviceId = :DeviceId, ExpiresAt = :ExpiresAt WHERE Id = :Id"
_, err := me.GetMaster().Exec(query, map[string]interface{}{"DeviceId": deviceId, "Id": id, "ExpiresAt": expiresAt})
if err != nil {
return "", model.NewAppError("SqlSessionStore.UpdateDeviceId", "store.sql_session.update_device_id.app_error", nil, err.Error(), http.StatusInternalServerError)
}
return deviceId, nil
}
func (me SqlSessionStore) AnalyticsSessionCount() (int64, *model.AppError) {