File tree 3 files changed +23
-5
lines changed
3 files changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,7 @@ import "time"
9
9
10
10
// Commentable can be commented upon
11
11
type Commentable interface {
12
- GetLocalIndex () int64
13
- GetForeignIndex () int64
12
+ Reviewable
14
13
GetContext () DownloaderContext
15
14
}
16
15
Original file line number Diff line number Diff line change @@ -35,6 +35,15 @@ func (issue *Issue) GetExternalName() string { return issue.PosterName }
35
35
// GetExternalID ExternalUserMigrated interface
36
36
func (issue * Issue ) GetExternalID () int64 { return issue .PosterID }
37
37
38
- func (issue * Issue ) GetLocalIndex () int64 { return issue .Number }
39
- func (issue * Issue ) GetForeignIndex () int64 { return issue .ForeignIndex }
38
+ func (issue * Issue ) GetLocalIndex () int64 { return issue .Number }
39
+
40
+ func (issue * Issue ) GetForeignIndex () int64 {
41
+ // see the comment of Reviewable.GetForeignIndex
42
+ // if there is no ForeignIndex, then use LocalIndex
43
+ if issue .ForeignIndex == 0 {
44
+ return issue .Number
45
+ }
46
+ return issue .ForeignIndex
47
+ }
48
+
40
49
func (issue * Issue ) GetContext () DownloaderContext { return issue .Context }
Original file line number Diff line number Diff line change @@ -9,6 +9,16 @@ import "time"
9
9
// Reviewable can be reviewed
10
10
type Reviewable interface {
11
11
GetLocalIndex () int64
12
+
13
+ // GetForeignIndex presents the foreign index, which could be misused:
14
+ // For example, if there are 2 Gitea sites: site-A exports a dataset, then site-B imports it:
15
+ // * if site-A exports files by using its LocalIndex
16
+ // * from site-A's view, LocalIndex is site-A's IssueIndex while ForeignIndex is site-B's IssueIndex
17
+ // * but from site-B's view, LocalIndex is site-B's IssueIndex while ForeignIndex is site-A's IssueIndex
18
+ //
19
+ // So the exporting/importing must be paired, but the meaning of them looks confusing then:
20
+ // * either site-A and site-B both use LocalIndex during dumping/restoring
21
+ // * or site-A and site-B both use ForeignIndex
12
22
GetForeignIndex () int64
13
23
}
14
24
@@ -38,7 +48,7 @@ type Review struct {
38
48
// GetExternalName ExternalUserMigrated interface
39
49
func (r * Review ) GetExternalName () string { return r .ReviewerName }
40
50
41
- // ExternalID ExternalUserMigrated interface
51
+ // GetExternalID ExternalUserMigrated interface
42
52
func (r * Review ) GetExternalID () int64 { return r .ReviewerID }
43
53
44
54
// ReviewComment represents a review comment
You can’t perform that action at this time.
0 commit comments