1
0
Fork 0
forked from forgejo/forgejo

Migrate reactions when migrating repository from github (#9599)

* Migrate reactions when migrating repository from github

* fix missed sleep

* fix tests

* update reactions when external user binding

* Fix test

* fix tests

* change the copy head

* fix test

* fix migrator add/delete reaction
This commit is contained in:
Lunny Xiao 2020-01-15 19:14:07 +08:00 committed by Antoine GIRARD
parent 4e566df1c6
commit 2b3e931cde
18 changed files with 329 additions and 101 deletions

View file

@ -170,14 +170,12 @@ func TestGitHubDownloadRepo(t *testing.T) {
Description: "Good for newcomers",
},
},
Reactions: &base.Reactions{
TotalCount: 1,
PlusOne: 1,
MinusOne: 0,
Laugh: 0,
Confused: 0,
Heart: 0,
Hooray: 0,
Reactions: []*base.Reaction{
{
UserID: 1669571,
UserName: "mrsdizzie",
Content: "+1",
},
},
Closed: &closed1,
},
@ -198,14 +196,37 @@ func TestGitHubDownloadRepo(t *testing.T) {
Description: "This issue or pull request already exists",
},
},
Reactions: &base.Reactions{
TotalCount: 6,
PlusOne: 1,
MinusOne: 1,
Laugh: 1,
Confused: 1,
Heart: 1,
Hooray: 1,
Reactions: []*base.Reaction{
{
UserID: 1669571,
UserName: "mrsdizzie",
Content: "heart",
},
{
UserID: 1669571,
UserName: "mrsdizzie",
Content: "laugh",
},
{
UserID: 1669571,
UserName: "mrsdizzie",
Content: "-1",
},
{
UserID: 1669571,
UserName: "mrsdizzie",
Content: "confused",
},
{
UserID: 1669571,
UserName: "mrsdizzie",
Content: "hooray",
},
{
UserID: 1669571,
UserName: "mrsdizzie",
Content: "+1",
},
},
Closed: &closed2,
},
@ -223,14 +244,12 @@ func TestGitHubDownloadRepo(t *testing.T) {
Created: time.Date(2019, 11, 12, 21, 0, 13, 0, time.UTC),
Updated: time.Date(2019, 11, 12, 21, 0, 13, 0, time.UTC),
Content: "This is a comment",
Reactions: &base.Reactions{
TotalCount: 1,
PlusOne: 1,
MinusOne: 0,
Laugh: 0,
Confused: 0,
Heart: 0,
Hooray: 0,
Reactions: []*base.Reaction{
{
UserID: 1669571,
UserName: "mrsdizzie",
Content: "+1",
},
},
},
{
@ -240,15 +259,7 @@ func TestGitHubDownloadRepo(t *testing.T) {
Created: time.Date(2019, 11, 12, 22, 7, 14, 0, time.UTC),
Updated: time.Date(2019, 11, 12, 22, 7, 14, 0, time.UTC),
Content: "A second comment",
Reactions: &base.Reactions{
TotalCount: 0,
PlusOne: 0,
MinusOne: 0,
Laugh: 0,
Confused: 0,
Heart: 0,
Hooray: 0,
},
Reactions: nil,
},
}, comments[:2])
@ -331,6 +342,18 @@ func TestGitHubDownloadRepo(t *testing.T) {
},
Merged: false,
MergeCommitSHA: "565d1208f5fffdc1c5ae1a2436491eb9a5e4ebae",
Reactions: []*base.Reaction{
{
UserID: 81045,
UserName: "lunny",
Content: "heart",
},
{
UserID: 81045,
UserName: "lunny",
Content: "+1",
},
},
},
}, prs)
}