mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-29 05:06:11 +01:00
Fix missing updated time on migrated issues and comments (#9744)
* Fix missing updated time on migrated issues and comments * Fix testing and missing updated on migrating pullrequest Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
This commit is contained in:
parent
2677d071f9
commit
7f869c061e
|
@ -14,6 +14,7 @@ type Comment struct {
|
||||||
PosterName string
|
PosterName string
|
||||||
PosterEmail string
|
PosterEmail string
|
||||||
Created time.Time
|
Created time.Time
|
||||||
|
Updated time.Time
|
||||||
Content string
|
Content string
|
||||||
Reactions *Reactions
|
Reactions *Reactions
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ type Issue struct {
|
||||||
State string // closed, open
|
State string // closed, open
|
||||||
IsLocked bool
|
IsLocked bool
|
||||||
Created time.Time
|
Created time.Time
|
||||||
|
Updated time.Time
|
||||||
Closed *time.Time
|
Closed *time.Time
|
||||||
Labels []*Label
|
Labels []*Label
|
||||||
Reactions *Reactions
|
Reactions *Reactions
|
||||||
|
|
|
@ -21,6 +21,7 @@ type PullRequest struct {
|
||||||
Milestone string
|
Milestone string
|
||||||
State string
|
State string
|
||||||
Created time.Time
|
Created time.Time
|
||||||
|
Updated time.Time
|
||||||
Closed *time.Time
|
Closed *time.Time
|
||||||
Labels []*Label
|
Labels []*Label
|
||||||
PatchURL string
|
PatchURL string
|
||||||
|
|
|
@ -334,6 +334,7 @@ func (g *GiteaLocalUploader) CreateIssues(issues ...*base.Issue) error {
|
||||||
MilestoneID: milestoneID,
|
MilestoneID: milestoneID,
|
||||||
Labels: labels,
|
Labels: labels,
|
||||||
CreatedUnix: timeutil.TimeStamp(issue.Created.Unix()),
|
CreatedUnix: timeutil.TimeStamp(issue.Created.Unix()),
|
||||||
|
UpdatedUnix: timeutil.TimeStamp(issue.Updated.Unix()),
|
||||||
}
|
}
|
||||||
|
|
||||||
userid, ok := g.userMap[issue.PosterID]
|
userid, ok := g.userMap[issue.PosterID]
|
||||||
|
@ -408,6 +409,7 @@ func (g *GiteaLocalUploader) CreateComments(comments ...*base.Comment) error {
|
||||||
Type: models.CommentTypeComment,
|
Type: models.CommentTypeComment,
|
||||||
Content: comment.Content,
|
Content: comment.Content,
|
||||||
CreatedUnix: timeutil.TimeStamp(comment.Created.Unix()),
|
CreatedUnix: timeutil.TimeStamp(comment.Created.Unix()),
|
||||||
|
UpdatedUnix: timeutil.TimeStamp(comment.Updated.Unix()),
|
||||||
}
|
}
|
||||||
|
|
||||||
if userid > 0 {
|
if userid > 0 {
|
||||||
|
@ -576,6 +578,7 @@ func (g *GiteaLocalUploader) newPullRequest(pr *base.PullRequest) (*models.PullR
|
||||||
IsLocked: pr.IsLocked,
|
IsLocked: pr.IsLocked,
|
||||||
Labels: labels,
|
Labels: labels,
|
||||||
CreatedUnix: timeutil.TimeStamp(pr.Created.Unix()),
|
CreatedUnix: timeutil.TimeStamp(pr.Created.Unix()),
|
||||||
|
UpdatedUnix: timeutil.TimeStamp(pr.Updated.Unix()),
|
||||||
}
|
}
|
||||||
|
|
||||||
userid, ok := g.userMap[pr.PosterID]
|
userid, ok := g.userMap[pr.PosterID]
|
||||||
|
|
|
@ -385,6 +385,7 @@ func (g *GithubDownloaderV3) GetIssues(page, perPage int) ([]*base.Issue, bool,
|
||||||
Milestone: milestone,
|
Milestone: milestone,
|
||||||
State: *issue.State,
|
State: *issue.State,
|
||||||
Created: *issue.CreatedAt,
|
Created: *issue.CreatedAt,
|
||||||
|
Updated: *issue.UpdatedAt,
|
||||||
Labels: labels,
|
Labels: labels,
|
||||||
Reactions: reactions,
|
Reactions: reactions,
|
||||||
Closed: issue.ClosedAt,
|
Closed: issue.ClosedAt,
|
||||||
|
@ -428,6 +429,7 @@ func (g *GithubDownloaderV3) GetComments(issueNumber int64) ([]*base.Comment, er
|
||||||
PosterEmail: email,
|
PosterEmail: email,
|
||||||
Content: *comment.Body,
|
Content: *comment.Body,
|
||||||
Created: *comment.CreatedAt,
|
Created: *comment.CreatedAt,
|
||||||
|
Updated: *comment.UpdatedAt,
|
||||||
Reactions: reactions,
|
Reactions: reactions,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -523,6 +525,7 @@ func (g *GithubDownloaderV3) GetPullRequests(page, perPage int) ([]*base.PullReq
|
||||||
Milestone: milestone,
|
Milestone: milestone,
|
||||||
State: *pr.State,
|
State: *pr.State,
|
||||||
Created: *pr.CreatedAt,
|
Created: *pr.CreatedAt,
|
||||||
|
Updated: *pr.UpdatedAt,
|
||||||
Closed: pr.ClosedAt,
|
Closed: pr.ClosedAt,
|
||||||
Labels: labels,
|
Labels: labels,
|
||||||
Merged: merged,
|
Merged: merged,
|
||||||
|
|
|
@ -157,6 +157,7 @@ func TestGitHubDownloadRepo(t *testing.T) {
|
||||||
PosterName: "guillep2k",
|
PosterName: "guillep2k",
|
||||||
State: "closed",
|
State: "closed",
|
||||||
Created: time.Date(2019, 11, 9, 17, 0, 29, 0, time.UTC),
|
Created: time.Date(2019, 11, 9, 17, 0, 29, 0, time.UTC),
|
||||||
|
Updated: time.Date(2019, 11, 12, 20, 29, 53, 0, time.UTC),
|
||||||
Labels: []*base.Label{
|
Labels: []*base.Label{
|
||||||
{
|
{
|
||||||
Name: "bug",
|
Name: "bug",
|
||||||
|
@ -189,6 +190,7 @@ func TestGitHubDownloadRepo(t *testing.T) {
|
||||||
PosterName: "mrsdizzie",
|
PosterName: "mrsdizzie",
|
||||||
State: "closed",
|
State: "closed",
|
||||||
Created: time.Date(2019, 11, 12, 21, 0, 6, 0, time.UTC),
|
Created: time.Date(2019, 11, 12, 21, 0, 6, 0, time.UTC),
|
||||||
|
Updated: time.Date(2019, 11, 12, 22, 7, 14, 0, time.UTC),
|
||||||
Labels: []*base.Label{
|
Labels: []*base.Label{
|
||||||
{
|
{
|
||||||
Name: "duplicate",
|
Name: "duplicate",
|
||||||
|
@ -219,6 +221,7 @@ func TestGitHubDownloadRepo(t *testing.T) {
|
||||||
PosterID: 1669571,
|
PosterID: 1669571,
|
||||||
PosterName: "mrsdizzie",
|
PosterName: "mrsdizzie",
|
||||||
Created: time.Date(2019, 11, 12, 21, 0, 13, 0, time.UTC),
|
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",
|
Content: "This is a comment",
|
||||||
Reactions: &base.Reactions{
|
Reactions: &base.Reactions{
|
||||||
TotalCount: 1,
|
TotalCount: 1,
|
||||||
|
@ -235,6 +238,7 @@ func TestGitHubDownloadRepo(t *testing.T) {
|
||||||
PosterID: 1669571,
|
PosterID: 1669571,
|
||||||
PosterName: "mrsdizzie",
|
PosterName: "mrsdizzie",
|
||||||
Created: time.Date(2019, 11, 12, 22, 7, 14, 0, time.UTC),
|
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",
|
Content: "A second comment",
|
||||||
Reactions: &base.Reactions{
|
Reactions: &base.Reactions{
|
||||||
TotalCount: 0,
|
TotalCount: 0,
|
||||||
|
@ -266,6 +270,7 @@ func TestGitHubDownloadRepo(t *testing.T) {
|
||||||
PosterName: "mrsdizzie",
|
PosterName: "mrsdizzie",
|
||||||
State: "closed",
|
State: "closed",
|
||||||
Created: time.Date(2019, 11, 12, 21, 21, 43, 0, time.UTC),
|
Created: time.Date(2019, 11, 12, 21, 21, 43, 0, time.UTC),
|
||||||
|
Updated: time.Date(2019, 11, 12, 21, 39, 28, 0, time.UTC),
|
||||||
Labels: []*base.Label{
|
Labels: []*base.Label{
|
||||||
{
|
{
|
||||||
Name: "documentation",
|
Name: "documentation",
|
||||||
|
@ -302,6 +307,7 @@ func TestGitHubDownloadRepo(t *testing.T) {
|
||||||
PosterName: "mrsdizzie",
|
PosterName: "mrsdizzie",
|
||||||
State: "open",
|
State: "open",
|
||||||
Created: time.Date(2019, 11, 12, 21, 54, 18, 0, time.UTC),
|
Created: time.Date(2019, 11, 12, 21, 54, 18, 0, time.UTC),
|
||||||
|
Updated: time.Date(2020, 1, 4, 11, 30, 1, 0, time.UTC),
|
||||||
Labels: []*base.Label{
|
Labels: []*base.Label{
|
||||||
{
|
{
|
||||||
Name: "bug",
|
Name: "bug",
|
||||||
|
|
Loading…
Reference in a new issue