mapCommentFromNode converts a discussionCommentNode into the domain DiscussionComment type.
(n discussionCommentNode)
| 505 | |
| 506 | // mapCommentFromNode converts a discussionCommentNode into the domain DiscussionComment type. |
| 507 | func mapCommentFromNode(n discussionCommentNode) DiscussionComment { |
| 508 | dc := DiscussionComment{ |
| 509 | ID: n.ID, |
| 510 | URL: n.URL, |
| 511 | Author: mapActorFromListNode(n.Author), |
| 512 | Body: n.Body, |
| 513 | CreatedAt: n.CreatedAt, |
| 514 | IsAnswer: n.IsAnswer, |
| 515 | UpvoteCount: n.UpvoteCount, |
| 516 | } |
| 517 | |
| 518 | for _, rg := range n.ReactionGroups { |
| 519 | dc.ReactionGroups = append(dc.ReactionGroups, ReactionGroup{ |
| 520 | Content: rg.Content, |
| 521 | TotalCount: rg.Users.TotalCount, |
| 522 | }) |
| 523 | } |
| 524 | |
| 525 | replyComments := make([]DiscussionComment, len(n.Replies.Nodes)) |
| 526 | for i, r := range n.Replies.Nodes { |
| 527 | replyComments[i] = mapReplyFromNode(r) |
| 528 | } |
| 529 | dc.Replies = DiscussionCommentList{ |
| 530 | Comments: replyComments, |
| 531 | TotalCount: n.Replies.TotalCount, |
| 532 | Direction: DiscussionCommentListDirectionBackward, |
| 533 | } |
| 534 | |
| 535 | return dc |
| 536 | } |
| 537 | |
| 538 | func (c *discussionClient) GetWithComments(repo ghrepo.Interface, number int32, limit int, after string, newest bool) (*Discussion, error) { |
| 539 | meta, err := c.getRepositoryMeta(repo) |
no test coverage detected