aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/github/import.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2022-11-15 12:25:48 +0100
committerGitHub <noreply@github.com>2022-11-15 12:25:48 +0100
commit9b393b487308da156c5988bb7c2d2747f7b7f8aa (patch)
tree8cf4307bf48f016e0f8728c311bcc53ce38432e3 /bridge/github/import.go
parent55a2e8e4485fe63fbda759540958c7190dfeb85c (diff)
parent3c6ebc2bfd50b72ff786a2cfd3bbdeb15b478dd3 (diff)
downloadgit-bug-9b393b487308da156c5988bb7c2d2747f7b7f8aa.tar.gz
Merge pull request #913 from MichaelMure/comment-id-fix
core: bubble up the comment ID when created, or edited the first comment
Diffstat (limited to 'bridge/github/import.go')
-rw-r--r--bridge/github/import.go22
1 files changed, 12 insertions, 10 deletions
diff --git a/bridge/github/import.go b/bridge/github/import.go
index 5b2bf54b..7ccac3fb 100644
--- a/bridge/github/import.go
+++ b/bridge/github/import.go
@@ -274,7 +274,7 @@ func (gi *githubImporter) ensureTimelineItem(ctx context.Context, repo *cache.Re
return err
}
- gi.out <- core.NewImportLabelChange(op.Id())
+ gi.out <- core.NewImportLabelChange(b.Id(), op.Id())
return nil
case "UnlabeledEvent":
@@ -304,7 +304,7 @@ func (gi *githubImporter) ensureTimelineItem(ctx context.Context, repo *cache.Re
return err
}
- gi.out <- core.NewImportLabelChange(op.Id())
+ gi.out <- core.NewImportLabelChange(b.Id(), op.Id())
return nil
case "ClosedEvent":
@@ -330,7 +330,7 @@ func (gi *githubImporter) ensureTimelineItem(ctx context.Context, repo *cache.Re
return err
}
- gi.out <- core.NewImportStatusChange(op.Id())
+ gi.out <- core.NewImportStatusChange(b.Id(), op.Id())
return nil
case "ReopenedEvent":
@@ -356,7 +356,7 @@ func (gi *githubImporter) ensureTimelineItem(ctx context.Context, repo *cache.Re
return err
}
- gi.out <- core.NewImportStatusChange(op.Id())
+ gi.out <- core.NewImportStatusChange(b.Id(), op.Id())
return nil
case "RenamedTitleEvent":
@@ -392,7 +392,7 @@ func (gi *githubImporter) ensureTimelineItem(ctx context.Context, repo *cache.Re
return err
}
- gi.out <- core.NewImportTitleEdition(op.Id())
+ gi.out <- core.NewImportTitleEdition(b.Id(), op.Id())
return nil
}
@@ -425,11 +425,13 @@ func (gi *githubImporter) ensureCommentEdit(ctx context.Context, repo *cache.Rep
return nil
}
+ commentId := entity.CombineIds(b.Id(), target)
+
// comment edition
- op, err := b.EditCommentRaw(
+ _, err = b.EditCommentRaw(
editor,
edit.CreatedAt.Unix(),
- entity.CombineIds(b.Id(), target),
+ commentId,
text.Cleanup(string(*edit.Diff)),
map[string]string{
metaKeyGithubId: parseId(edit.Id),
@@ -440,7 +442,7 @@ func (gi *githubImporter) ensureCommentEdit(ctx context.Context, repo *cache.Rep
return err
}
- gi.out <- core.NewImportCommentEdition(op.Id())
+ gi.out <- core.NewImportCommentEdition(b.Id(), commentId)
return nil
}
@@ -469,7 +471,7 @@ func (gi *githubImporter) ensureComment(ctx context.Context, repo *cache.RepoCac
}
// add comment operation
- op, err := b.AddCommentRaw(
+ commentId, _, err := b.AddCommentRaw(
author,
comment.CreatedAt.Unix(),
text.Cleanup(textInput),
@@ -483,7 +485,7 @@ func (gi *githubImporter) ensureComment(ctx context.Context, repo *cache.RepoCac
return err
}
- gi.out <- core.NewImportComment(op.Id())
+ gi.out <- core.NewImportComment(b.Id(), commentId)
return nil
}