Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions modules/migration/comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ type Commentable interface {
type Comment struct {
IssueIndex int64 `yaml:"issue_index"`
Index int64
CommentType int64
PosterID int64 `yaml:"poster_id"`
PosterName string `yaml:"poster_name"`
PosterEmail string `yaml:"poster_email"`
Created time.Time
Updated time.Time
Content string
Reactions []*Reaction
Meta map[string]interface{} // see models/issues/comment.go for fields in Comment struct
}

// GetExternalName ExternalUserMigrated interface
Expand Down
17 changes: 15 additions & 2 deletions services/migrations/gitea_uploader.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,15 +462,28 @@ func (g *GiteaLocalUploader) CreateComments(comments ...*base.Comment) error {
if comment.Updated.IsZero() {
comment.Updated = comment.Created
}

if comment.CommentType == 0 {
// if type field is missing, then assume a normal comment
comment.CommentType = int64(issues_model.CommentTypeComment)
}
cm := issues_model.Comment{
IssueID: issue.ID,
Type: issues_model.CommentTypeComment,
Type: issues_model.CommentType(comment.CommentType),
Content: comment.Content,
CreatedUnix: timeutil.TimeStamp(comment.Created.Unix()),
UpdatedUnix: timeutil.TimeStamp(comment.Updated.Unix()),
}

switch issues_model.CommentType(comment.CommentType) {
case issues_model.CommentTypeLabel:
// TODO: add label to issue
case issues_model.CommentTypeAssignees:
// TODO: add assignee to issue
case issues_model.CommentTypeChangeTitle:
// TODO: change issue title
default:
}

if err := g.remapUser(comment, &cm); err != nil {
return err
}
Expand Down