From cc643284de106a609b4ac03ed2a7f615ab6d312a Mon Sep 17 00:00:00 2001 From: singuliere <35190819+singuliere@users.noreply.github.com> Date: Sun, 6 Mar 2022 20:00:41 +0100 Subject: Add Index to comment for migrations and mirroring (#18806) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Comments have an id (see Gitea[0], GitLab[1], GitHub[2], etc.), and the comment migration format must represent it during migrations so that it can be used during mirroring or incremental migrations. [0] https://try.gitea.io/api/swagger#/issue/issueGetComment [1] https://docs.gitlab.com/ee/api/discussions.html#get-single-issue-discussion-item [2] https://docs.github.com/en/rest/reference/issues#get-an-issue-comment Signed-off-by: Loïc Dachary Co-authored-by: Loïc Dachary --- services/migrations/codebase.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'services/migrations/codebase.go') diff --git a/services/migrations/codebase.go b/services/migrations/codebase.go index 13e9327c33..be0b5d4004 100644 --- a/services/migrations/codebase.go +++ b/services/migrations/codebase.go @@ -371,6 +371,7 @@ func (d *CodebaseDownloader) GetIssues(page, perPage int) ([]*base.Issue, bool, poster := d.tryGetUser(note.UserID.Value) comments = append(comments, &base.Comment{ IssueIndex: issue.TicketID.Value, + Index: note.ID.Value, PosterID: poster.ID, PosterName: poster.Name, PosterEmail: poster.Email, @@ -481,7 +482,11 @@ func (d *CodebaseDownloader) GetPullRequests(page, perPage int) ([]*base.PullReq Type string `xml:"type,attr"` Comment []struct { Content string `xml:"content"` - UserID struct { + ID struct { + Value int64 `xml:",chardata"` + Type string `xml:"type,attr"` + } `xml:"id"` + UserID struct { Value int64 `xml:",chardata"` Type string `xml:"type,attr"` } `xml:"user-id"` @@ -528,6 +533,7 @@ func (d *CodebaseDownloader) GetPullRequests(page, perPage int) ([]*base.PullReq poster := d.tryGetUser(comment.UserID.Value) comments = append(comments, &base.Comment{ IssueIndex: number, + Index: comment.ID.Value, PosterID: poster.ID, PosterName: poster.Name, PosterEmail: poster.Email, -- cgit v1.2.3