( ctx context.Context, repo *types.RepositoryCore, pr *types.PullReq, in *CommentCreateInput, cc *types.CodeComment, cut git.DiffCutOutput, )
| 400 | } |
| 401 | |
| 402 | func (c *Controller) migrateCodeComment( |
| 403 | ctx context.Context, |
| 404 | repo *types.RepositoryCore, |
| 405 | pr *types.PullReq, |
| 406 | in *CommentCreateInput, |
| 407 | cc *types.CodeComment, |
| 408 | cut git.DiffCutOutput, |
| 409 | ) { |
| 410 | needsNewLineMigrate := in.SourceCommitSHA != pr.SourceSHA |
| 411 | needsOldLineMigrate := cut.MergeBaseSHA.String() != pr.MergeBaseSHA |
| 412 | if !needsNewLineMigrate && !needsOldLineMigrate { |
| 413 | return |
| 414 | } |
| 415 | |
| 416 | comments := []*types.CodeComment{cc} |
| 417 | |
| 418 | if needsNewLineMigrate { |
| 419 | c.codeCommentMigrator.MigrateNew(ctx, repo.GitUID, pr.SourceSHA, comments) |
| 420 | } |
| 421 | if needsOldLineMigrate { |
| 422 | c.codeCommentMigrator.MigrateOld(ctx, repo.GitUID, pr.MergeBaseSHA, comments) |
| 423 | } |
| 424 | |
| 425 | if errMigrateUpdate := c.codeCommentView.UpdateAll(ctx, comments); errMigrateUpdate != nil { |
| 426 | // non-critical error |
| 427 | log.Ctx(ctx).Err(errMigrateUpdate). |
| 428 | Msgf("failed to migrate code comment to the latest source/merge-base commit SHA") |
| 429 | } |
| 430 | } |
| 431 | |
| 432 | func (c *Controller) reportCommentCreated( |
| 433 | ctx context.Context, |
no test coverage detected