|
|
|
@ -71,7 +71,7 @@ func InvalidateCodeComments(ctx context.Context, prs issues_model.PullRequestLis |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// CreateCodeComment creates a comment on the code line
|
|
|
|
|
func CreateCodeComment(ctx context.Context, doer *user_model.User, gitRepo *git.Repository, issue *issues_model.Issue, line int64, content, treePath string, pendingReview bool, replyReviewID int64, latestCommitID string) (*issues_model.Comment, error) { |
|
|
|
|
func CreateCodeComment(ctx context.Context, doer *user_model.User, gitRepo *git.Repository, issue *issues_model.Issue, line int64, content, treePath string, pendingReview bool, replyReviewID int64, latestCommitID string, attachments []string) (*issues_model.Comment, error) { |
|
|
|
|
var ( |
|
|
|
|
existsReview bool |
|
|
|
|
err error |
|
|
|
@ -104,6 +104,7 @@ func CreateCodeComment(ctx context.Context, doer *user_model.User, gitRepo *git. |
|
|
|
|
treePath, |
|
|
|
|
line, |
|
|
|
|
replyReviewID, |
|
|
|
|
attachments, |
|
|
|
|
) |
|
|
|
|
if err != nil { |
|
|
|
|
return nil, err |
|
|
|
@ -144,6 +145,7 @@ func CreateCodeComment(ctx context.Context, doer *user_model.User, gitRepo *git. |
|
|
|
|
treePath, |
|
|
|
|
line, |
|
|
|
|
review.ID, |
|
|
|
|
attachments, |
|
|
|
|
) |
|
|
|
|
if err != nil { |
|
|
|
|
return nil, err |
|
|
|
@ -162,7 +164,7 @@ func CreateCodeComment(ctx context.Context, doer *user_model.User, gitRepo *git. |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// createCodeComment creates a plain code comment at the specified line / path
|
|
|
|
|
func createCodeComment(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, issue *issues_model.Issue, content, treePath string, line, reviewID int64) (*issues_model.Comment, error) { |
|
|
|
|
func createCodeComment(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, issue *issues_model.Issue, content, treePath string, line, reviewID int64, attachments []string) (*issues_model.Comment, error) { |
|
|
|
|
var commitID, patch string |
|
|
|
|
if err := issue.LoadPullRequest(ctx); err != nil { |
|
|
|
|
return nil, fmt.Errorf("LoadPullRequest: %w", err) |
|
|
|
@ -260,6 +262,7 @@ func createCodeComment(ctx context.Context, doer *user_model.User, repo *repo_mo |
|
|
|
|
ReviewID: reviewID, |
|
|
|
|
Patch: patch, |
|
|
|
|
Invalidated: invalidated, |
|
|
|
|
Attachments: attachments, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|