From 45b04351d8d02e53b3401b0ee23f7cbe750b63cd Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Mon, 3 May 2021 11:45:15 +0200 Subject: bug: have a type for combined ids, fix https://github.com/MichaelMure/git-bug/issues/653 --- bridge/github/export_test.go | 7 +++++-- bridge/github/import.go | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'bridge/github') diff --git a/bridge/github/export_test.go b/bridge/github/export_test.go index 93cc47c0..de2d3f34 100644 --- a/bridge/github/export_test.go +++ b/bridge/github/export_test.go @@ -16,6 +16,7 @@ import ( "github.com/MichaelMure/git-bug/bridge/core" "github.com/MichaelMure/git-bug/bridge/core/auth" "github.com/MichaelMure/git-bug/cache" + "github.com/MichaelMure/git-bug/entity" "github.com/MichaelMure/git-bug/entity/dag" "github.com/MichaelMure/git-bug/repository" "github.com/MichaelMure/git-bug/util/interrupt" @@ -66,13 +67,15 @@ func testCases(t *testing.T, repo *cache.RepoCache) []*testCase { bugWithCommentEditions, createOp, err := repo.NewBug("bug with comments editions", "new bug") require.NoError(t, err) - _, err = bugWithCommentEditions.EditComment(createOp.Id(), "first comment edited") + _, err = bugWithCommentEditions.EditComment( + entity.CombineIds(bugWithCommentEditions.Id(), createOp.Id()), "first comment edited") require.NoError(t, err) commentOp, err := bugWithCommentEditions.AddComment("first comment") require.NoError(t, err) - _, err = bugWithCommentEditions.EditComment(commentOp.Id(), "first comment edited") + _, err = bugWithCommentEditions.EditComment( + entity.CombineIds(bugWithCommentEditions.Id(), commentOp.Id()), "first comment edited") require.NoError(t, err) // bug status changed diff --git a/bridge/github/import.go b/bridge/github/import.go index 722bf256..5b2bf54b 100644 --- a/bridge/github/import.go +++ b/bridge/github/import.go @@ -405,6 +405,7 @@ func (gi *githubImporter) ensureCommentEdit(ctx context.Context, repo *cache.Rep if err != nil { return err } + // check if the comment edition already exist _, err = b.ResolveOperationWithMetadata(metaKeyGithubId, parseId(edit.Id)) if err == nil { return nil @@ -428,7 +429,7 @@ func (gi *githubImporter) ensureCommentEdit(ctx context.Context, repo *cache.Rep op, err := b.EditCommentRaw( editor, edit.CreatedAt.Unix(), - target, + entity.CombineIds(b.Id(), target), text.Cleanup(string(*edit.Diff)), map[string]string{ metaKeyGithubId: parseId(edit.Id), -- cgit