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