Commit d5fa2e7 1 parent 3ae78bc commit d5fa2e7 Copy full SHA for d5fa2e7
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 @@ -8,8 +8,7 @@ import "time"
8
8
9
9
// Commentable can be commented upon
10
10
type Commentable interface {
11
- GetLocalIndex () int64
12
- GetForeignIndex () int64
11
+ Reviewable
13
12
GetContext () DownloaderContext
14
13
}
15
14
Original file line number Diff line number Diff line change @@ -34,6 +34,15 @@ func (issue *Issue) GetExternalName() string { return issue.PosterName }
34
34
// GetExternalID ExternalUserMigrated interface
35
35
func (issue * Issue ) GetExternalID () int64 { return issue .PosterID }
36
36
37
- func (issue * Issue ) GetLocalIndex () int64 { return issue .Number }
38
- func (issue * Issue ) GetForeignIndex () int64 { return issue .ForeignIndex }
37
+ func (issue * Issue ) GetLocalIndex () int64 { return issue .Number }
38
+
39
+ func (issue * Issue ) GetForeignIndex () int64 {
40
+ // see the comment of Reviewable.GetForeignIndex
41
+ // if there is no ForeignIndex, then use LocalIndex
42
+ if issue .ForeignIndex == 0 {
43
+ return issue .Number
44
+ }
45
+ return issue .ForeignIndex
46
+ }
47
+
39
48
func (issue * Issue ) GetContext () DownloaderContext { return issue .Context }
Original file line number Diff line number Diff line change @@ -8,6 +8,16 @@ import "time"
8
8
// Reviewable can be reviewed
9
9
type Reviewable interface {
10
10
GetLocalIndex () int64
11
+
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
17
+ //
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
11
21
GetForeignIndex () int64
12
22
}
13
23
@@ -37,7 +47,7 @@ type Review struct {
37
47
// GetExternalName ExternalUserMigrated interface
38
48
func (r * Review ) GetExternalName () string { return r .ReviewerName }
39
49
40
- // ExternalID ExternalUserMigrated interface
50
+ // GetExternalID ExternalUserMigrated interface
41
51
func (r * Review ) GetExternalID () int64 { return r .ReviewerID }
42
52
43
53
// ReviewComment represents a review comment
You can’t perform that action at this time.
0 commit comments