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 @@ -8,8 +8,7 @@ import "time"
88
99// Commentable can be commented upon
1010type Commentable interface {
11- GetLocalIndex () int64
12- GetForeignIndex () int64
11+ Reviewable
1312 GetContext () DownloaderContext
1413}
1514
Original file line number Diff line number Diff line change @@ -34,6 +34,15 @@ func (issue *Issue) GetExternalName() string { return issue.PosterName }
3434// GetExternalID ExternalUserMigrated interface
3535func (issue * Issue ) GetExternalID () int64 { return issue .PosterID }
3636
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+
3948func (issue * Issue ) GetContext () DownloaderContext { return issue .Context }
Original file line number Diff line number Diff line change @@ -8,6 +8,16 @@ import "time"
88// Reviewable can be reviewed
99type Reviewable interface {
1010 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
1121 GetForeignIndex () int64
1222}
1323
@@ -37,7 +47,7 @@ type Review struct {
3747// GetExternalName ExternalUserMigrated interface
3848func (r * Review ) GetExternalName () string { return r .ReviewerName }
3949
40- // ExternalID ExternalUserMigrated interface
50+ // GetExternalID ExternalUserMigrated interface
4151func (r * Review ) GetExternalID () int64 { return r .ReviewerID }
4252
4353// ReviewComment represents a review comment
You can’t perform that action at this time.
0 commit comments