MCPcopy Index your code
hub / github.com/git-bug/git-bug / BugAddComment

Method BugAddComment

api/graphql/resolvers/mutation.go:70–100  ·  view source on GitHub ↗
(ctx context.Context, input models.BugAddCommentInput)

Source from the content-addressed store, hash-verified

68}
69
70func (r mutationResolver) BugAddComment(ctx context.Context, input models.BugAddCommentInput) (*models.BugAddCommentPayload, error) {
71 repo, b, err := r.getBug(input.RepoRef, input.Prefix)
72 if err != nil {
73 return nil, err
74 }
75
76 author, err := auth.UserFromCtx(ctx, repo)
77 if err != nil {
78 return nil, err
79 }
80
81 _, op, err := b.AddCommentRaw(author,
82 time.Now().Unix(),
83 text.Cleanup(input.Message),
84 input.Files,
85 nil)
86 if err != nil {
87 return nil, err
88 }
89
90 err = b.Commit()
91 if err != nil {
92 return nil, err
93 }
94
95 return &models.BugAddCommentPayload{
96 ClientMutationID: input.ClientMutationID,
97 Bug: models.NewLoadedBug(b.Snapshot()),
98 Operation: op,
99 }, nil
100}
101
102func (r mutationResolver) BugAddCommentAndClose(ctx context.Context, input models.BugAddCommentAndCloseInput) (*models.BugAddCommentAndClosePayload, error) {
103 repo, b, err := r.getBug(input.RepoRef, input.Prefix)

Callers

nothing calls this directly

Calls 7

getBugMethod · 0.95
UserFromCtxFunction · 0.92
CleanupFunction · 0.92
NewLoadedBugFunction · 0.92
AddCommentRawMethod · 0.80
SnapshotMethod · 0.80
CommitMethod · 0.65

Tested by

no test coverage detected