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.

review.go 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // Copyright 2019 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package migration
  4. import "time"
  5. // Reviewable can be reviewed
  6. type Reviewable interface {
  7. GetLocalIndex() int64
  8. // GetForeignIndex presents the foreign index, which could be misused:
  9. // For example, if there are 2 Gitea sites: site-A exports a dataset, then site-B imports it:
  10. // * if site-A exports files by using its LocalIndex
  11. // * from site-A's view, LocalIndex is site-A's IssueIndex while ForeignIndex is site-B's IssueIndex
  12. // * but from site-B's view, LocalIndex is site-B's IssueIndex while ForeignIndex is site-A's IssueIndex
  13. //
  14. // So the exporting/importing must be paired, but the meaning of them looks confusing then:
  15. // * either site-A and site-B both use LocalIndex during dumping/restoring
  16. // * or site-A and site-B both use ForeignIndex
  17. GetForeignIndex() int64
  18. }
  19. // enumerate all review states
  20. const (
  21. ReviewStatePending = "PENDING"
  22. ReviewStateApproved = "APPROVED"
  23. ReviewStateChangesRequested = "CHANGES_REQUESTED"
  24. ReviewStateCommented = "COMMENTED"
  25. ReviewStateRequestReview = "REQUEST_REVIEW"
  26. )
  27. // Review is a standard review information
  28. type Review struct {
  29. ID int64
  30. IssueIndex int64 `yaml:"issue_index"`
  31. ReviewerID int64 `yaml:"reviewer_id"`
  32. ReviewerName string `yaml:"reviewer_name"`
  33. Official bool
  34. CommitID string `yaml:"commit_id"`
  35. Content string
  36. CreatedAt time.Time `yaml:"created_at"`
  37. State string // PENDING, APPROVED, REQUEST_CHANGES, or COMMENT
  38. Comments []*ReviewComment
  39. }
  40. // GetExternalName ExternalUserMigrated interface
  41. func (r *Review) GetExternalName() string { return r.ReviewerName }
  42. // GetExternalID ExternalUserMigrated interface
  43. func (r *Review) GetExternalID() int64 { return r.ReviewerID }
  44. // ReviewComment represents a review comment
  45. type ReviewComment struct {
  46. ID int64
  47. InReplyTo int64 `yaml:"in_reply_to"`
  48. Content string
  49. TreePath string `yaml:"tree_path"`
  50. DiffHunk string `yaml:"diff_hunk"`
  51. Position int
  52. Line int
  53. CommitID string `yaml:"commit_id"`
  54. PosterID int64 `yaml:"poster_id"`
  55. Reactions []*Reaction
  56. CreatedAt time.Time `yaml:"created_at"`
  57. UpdatedAt time.Time `yaml:"updated_at"`
  58. }