Fixed errcheck issues in server/channels/app/migrations.go (#29067)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
cdfadcf47d
Коммит
1f7f0d20cd
@@ -91,7 +91,6 @@ issues:
|
|||||||
channels/app/helper_test.go|\
|
channels/app/helper_test.go|\
|
||||||
channels/app/import_functions.go|\
|
channels/app/import_functions.go|\
|
||||||
channels/app/integration_action.go|\
|
channels/app/integration_action.go|\
|
||||||
channels/app/migrations.go|\
|
|
||||||
channels/app/permissions.go|\
|
channels/app/permissions.go|\
|
||||||
channels/app/permissions_test.go|\
|
channels/app/permissions_test.go|\
|
||||||
channels/app/platform/helper_test.go|\
|
channels/app/platform/helper_test.go|\
|
||||||
|
|||||||
@@ -590,8 +590,8 @@ type AppIface interface {
|
|||||||
DoAppMigrations()
|
DoAppMigrations()
|
||||||
DoCheckForAdminNotifications(trial bool) *model.AppError
|
DoCheckForAdminNotifications(trial bool) *model.AppError
|
||||||
DoCommandRequest(rctx request.CTX, cmd *model.Command, p url.Values) (*model.Command, *model.CommandResponse, *model.AppError)
|
DoCommandRequest(rctx request.CTX, cmd *model.Command, p url.Values) (*model.Command, *model.CommandResponse, *model.AppError)
|
||||||
DoEmojisPermissionsMigration()
|
DoEmojisPermissionsMigration() error
|
||||||
DoGuestRolesCreationMigration()
|
DoGuestRolesCreationMigration() error
|
||||||
DoLocalRequest(c request.CTX, rawURL string, body []byte) (*http.Response, *model.AppError)
|
DoLocalRequest(c request.CTX, rawURL string, body []byte) (*http.Response, *model.AppError)
|
||||||
DoLogin(c request.CTX, w http.ResponseWriter, r *http.Request, user *model.User, deviceID string, isMobile, isOAuthUser, isSaml bool) (*model.Session, *model.AppError)
|
DoLogin(c request.CTX, w http.ResponseWriter, r *http.Request, user *model.User, deviceID string, isMobile, isOAuthUser, isSaml bool) (*model.Session, *model.AppError)
|
||||||
DoPostActionWithCookie(c request.CTX, postID, actionId, userID, selectedOption string, cookie *model.PostActionCookie) (string, *model.AppError)
|
DoPostActionWithCookie(c request.CTX, postID, actionId, userID, selectedOption string, cookie *model.PostActionCookie) (string, *model.AppError)
|
||||||
|
|||||||
@@ -255,7 +255,8 @@ func TestDoEmojisPermissionsMigration(t *testing.T) {
|
|||||||
sort.Strings(expectedSystemAdmin)
|
sort.Strings(expectedSystemAdmin)
|
||||||
|
|
||||||
th.ResetEmojisMigration()
|
th.ResetEmojisMigration()
|
||||||
th.App.DoEmojisPermissionsMigration()
|
err := th.App.DoEmojisPermissionsMigration()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
role3, err3 := th.App.GetRoleByName(context.Background(), model.SystemUserRoleId)
|
role3, err3 := th.App.GetRoleByName(context.Background(), model.SystemUserRoleId)
|
||||||
assert.Nil(t, err3)
|
assert.Nil(t, err3)
|
||||||
|
|||||||
@@ -104,8 +104,11 @@ func (a *App) SetPhase2PermissionsMigrationStatus(isComplete bool) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) DoEmojisPermissionsMigration() {
|
func (a *App) DoEmojisPermissionsMigration() error {
|
||||||
a.Srv().doEmojisPermissionsMigration()
|
if err := a.Srv().doEmojisPermissionsMigration(); err != nil {
|
||||||
|
return fmt.Errorf("Failed to complete emojis permissions migration: %w", err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) doEmojisPermissionsMigration() error {
|
func (s *Server) doEmojisPermissionsMigration() error {
|
||||||
@@ -162,8 +165,11 @@ func (s *Server) doEmojisPermissionsMigration() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) DoGuestRolesCreationMigration() {
|
func (a *App) DoGuestRolesCreationMigration() error {
|
||||||
a.Srv().doGuestRolesCreationMigration()
|
if err := a.Srv().doGuestRolesCreationMigration(); err != nil {
|
||||||
|
return fmt.Errorf("Failed to complete guest roles creation migration: %w", err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) doGuestRolesCreationMigration() error {
|
func (s *Server) doGuestRolesCreationMigration() error {
|
||||||
|
|||||||
@@ -4050,7 +4050,7 @@ func (a *OpenTracingAppLayer) DoCommandRequest(rctx request.CTX, cmd *model.Comm
|
|||||||
return resultVar0, resultVar1, resultVar2
|
return resultVar0, resultVar1, resultVar2
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *OpenTracingAppLayer) DoEmojisPermissionsMigration() {
|
func (a *OpenTracingAppLayer) DoEmojisPermissionsMigration() error {
|
||||||
origCtx := a.ctx
|
origCtx := a.ctx
|
||||||
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.DoEmojisPermissionsMigration")
|
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.DoEmojisPermissionsMigration")
|
||||||
|
|
||||||
@@ -4062,10 +4062,17 @@ func (a *OpenTracingAppLayer) DoEmojisPermissionsMigration() {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
defer span.Finish()
|
defer span.Finish()
|
||||||
a.app.DoEmojisPermissionsMigration()
|
resultVar0 := a.app.DoEmojisPermissionsMigration()
|
||||||
|
|
||||||
|
if resultVar0 != nil {
|
||||||
|
span.LogFields(spanlog.Error(resultVar0))
|
||||||
|
ext.Error.Set(span, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultVar0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *OpenTracingAppLayer) DoGuestRolesCreationMigration() {
|
func (a *OpenTracingAppLayer) DoGuestRolesCreationMigration() error {
|
||||||
origCtx := a.ctx
|
origCtx := a.ctx
|
||||||
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.DoGuestRolesCreationMigration")
|
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.DoGuestRolesCreationMigration")
|
||||||
|
|
||||||
@@ -4077,7 +4084,14 @@ func (a *OpenTracingAppLayer) DoGuestRolesCreationMigration() {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
defer span.Finish()
|
defer span.Finish()
|
||||||
a.app.DoGuestRolesCreationMigration()
|
resultVar0 := a.app.DoGuestRolesCreationMigration()
|
||||||
|
|
||||||
|
if resultVar0 != nil {
|
||||||
|
span.LogFields(spanlog.Error(resultVar0))
|
||||||
|
ext.Error.Set(span, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultVar0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *OpenTracingAppLayer) DoLocalRequest(c request.CTX, rawURL string, body []byte) (*http.Response, *model.AppError) {
|
func (a *OpenTracingAppLayer) DoLocalRequest(c request.CTX, rawURL string, body []byte) (*http.Response, *model.AppError) {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user