MCPcopy Create free account
hub / github.com/bytebase/bytebase / convertToIssueComment

Function convertToIssueComment

backend/api/v1/issue_service_converter.go:294–315  ·  view source on GitHub ↗
(issueName string, ic *store.IssueCommentMessage)

Source from the content-addressed store, hash-verified

292}
293
294func convertToIssueComment(issueName string, ic *store.IssueCommentMessage) *v1pb.IssueComment {
295 r := &v1pb.IssueComment{
296 Comment: ic.Payload.Comment,
297 CreateTime: timestamppb.New(ic.CreatedAt),
298 UpdateTime: timestamppb.New(ic.UpdatedAt),
299 Name: fmt.Sprintf("%s/%s%s", issueName, common.IssueCommentNamePrefix, ic.ResourceID),
300 Creator: common.FormatUserEmail(ic.CreatorEmail),
301 }
302
303 switch e := ic.Payload.Event.(type) {
304 case *storepb.IssueCommentPayload_Approval_:
305 r.Event = convertToIssueCommentEventApproval(e)
306 case *storepb.IssueCommentPayload_IssueUpdate_:
307 r.Event = convertToIssueCommentEventIssueUpdate(e)
308 case *storepb.IssueCommentPayload_PlanUpdate_:
309 projectID, _, _ := common.GetProjectIDIssueUID(issueName)
310 r.Event = convertToIssueCommentEventPlanUpdate(projectID, e)
311 default:
312 }
313
314 return r
315}
316
317func convertToIssueCommentEventApproval(a *storepb.IssueCommentPayload_Approval_) *v1pb.IssueComment_Approval_ {
318 return &v1pb.IssueComment_Approval_{

Callers 3

convertToIssueCommentsFunction · 0.85
CreateIssueCommentMethod · 0.85
UpdateIssueCommentMethod · 0.85

Tested by

no test coverage detected