(issueName string, ic *store.IssueCommentMessage)
| 292 | } |
| 293 | |
| 294 | func 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 | |
| 317 | func convertToIssueCommentEventApproval(a *storepb.IssueCommentPayload_Approval_) *v1pb.IssueComment_Approval_ { |
| 318 | return &v1pb.IssueComment_Approval_{ |
no test coverage detected