You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

issue_comment.go 637B

123456789101112131415161718192021222324
  1. // Copyright 2020 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package convert
  5. import (
  6. "code.gitea.io/gitea/models"
  7. api "code.gitea.io/gitea/modules/structs"
  8. )
  9. // ToComment converts a models.Comment to the api.Comment format
  10. func ToComment(c *models.Comment) *api.Comment {
  11. return &api.Comment{
  12. ID: c.ID,
  13. Poster: ToUser(c.Poster, false, false),
  14. HTMLURL: c.HTMLURL(),
  15. IssueURL: c.IssueURL(),
  16. PRURL: c.PRURL(),
  17. Body: c.Content,
  18. Created: c.CreatedUnix.AsTime(),
  19. Updated: c.UpdatedUnix.AsTime(),
  20. }
  21. }