[F3] ID remapping logic is in place, remove workaround

This commit is contained in:
Earl Warren 2023-04-27 12:03:50 +02:00
parent c770713656
commit d0fee30167
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
2 changed files with 4 additions and 9 deletions

View file

@ -110,7 +110,8 @@ func (o *Review) FromFormat(review *format.Review) {
}
*o = Review{
Review: issues_model.Review{
ID: review.GetID(),
ID: review.GetID(),
ReviewerID: review.ReviewerID.GetID(),
Reviewer: &user_model.User{
ID: review.ReviewerID.GetID(),
},
@ -191,12 +192,6 @@ func (o *ReviewProvider) Put(ctx context.Context, user *User, project *Project,
comment.ID = 0
}
r.IssueID = pullRequest.IssueID
// this is a workaround because the id remapping logic is missing, wait until it is implemented and remove it
u, err := user_model.GetUserByName(ctx, r.Reviewer.Name)
if err != nil {
panic(err)
}
r.ReviewerID = u.ID
if err := issues_model.InsertReviews([]*issues_model.Review{r}); err != nil {
panic(err)
}

View file

@ -61,7 +61,7 @@ func TestF3(t *testing.T) {
fixture.NewAsset()
fixture.NewIssueComment(nil)
fixture.NewPullRequestComment()
// fixture.NewReview()
fixture.NewReview()
fixture.NewIssueReaction()
fixture.NewCommentReaction()
@ -109,7 +109,7 @@ func TestF3(t *testing.T) {
assert.Contains(t, files, "/release/")
assert.Contains(t, files, "/asset/")
assert.Contains(t, files, "/comment/")
// assert.Contains(t, files, "/review/")
assert.Contains(t, files, "/review/")
assert.Contains(t, files, "/reaction/")
// f3_util.Command(context.Background(), "cp", "-a", f3.GetDirectory(), "abc")
})