File tree Expand file tree Collapse file tree 3 files changed +23
-5
lines changed Expand file tree Collapse file tree 3 files changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,7 @@ import "time"
99
1010// Commentable can be commented upon
1111type Commentable interface {
12- GetLocalIndex () int64
13- GetForeignIndex () int64
12+ Reviewable
1413 GetContext () DownloaderContext
1514}
1615
Original file line number Diff line number Diff line change @@ -35,6 +35,15 @@ func (issue *Issue) GetExternalName() string { return issue.PosterName }
3535// GetExternalID ExternalUserMigrated interface
3636func (issue * Issue ) GetExternalID () int64 { return issue .PosterID }
3737
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+
4049func (issue * Issue ) GetContext () DownloaderContext { return issue .Context }
Original file line number Diff line number Diff line change @@ -9,6 +9,16 @@ import "time"
99// Reviewable can be reviewed
1010type Reviewable interface {
1111 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
1222 GetForeignIndex () int64
1323}
1424
@@ -38,7 +48,7 @@ type Review struct {
3848// GetExternalName ExternalUserMigrated interface
3949func (r * Review ) GetExternalName () string { return r .ReviewerName }
4050
41- // ExternalID ExternalUserMigrated interface
51+ // GetExternalID ExternalUserMigrated interface
4252func (r * Review ) GetExternalID () int64 { return r .ReviewerID }
4353
4454// ReviewComment represents a review comment
You can’t perform that action at this time.
0 commit comments