@@ -9,11 +9,9 @@ import (
9
9
"fmt"
10
10
"regexp"
11
11
"sort"
12
- "strconv"
13
12
"strings"
14
13
15
14
"code.gitea.io/gitea/models/db"
16
- "code.gitea.io/gitea/models/foreignreference"
17
15
"code.gitea.io/gitea/models/organization"
18
16
"code.gitea.io/gitea/models/perm"
19
17
access_model "code.gitea.io/gitea/models/perm/access"
@@ -136,12 +134,11 @@ type Issue struct {
136
134
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
137
135
ClosedUnix timeutil.TimeStamp `xorm:"INDEX"`
138
136
139
- Attachments []* repo_model.Attachment `xorm:"-"`
140
- Comments []* Comment `xorm:"-"`
141
- Reactions ReactionList `xorm:"-"`
142
- TotalTrackedTime int64 `xorm:"-"`
143
- Assignees []* user_model.User `xorm:"-"`
144
- ForeignReference * foreignreference.ForeignReference `xorm:"-"`
137
+ Attachments []* repo_model.Attachment `xorm:"-"`
138
+ Comments []* Comment `xorm:"-"`
139
+ Reactions ReactionList `xorm:"-"`
140
+ TotalTrackedTime int64 `xorm:"-"`
141
+ Assignees []* user_model.User `xorm:"-"`
145
142
146
143
// IsLocked limits commenting abilities to users on an issue
147
144
// with write access
@@ -321,29 +318,6 @@ func (issue *Issue) loadReactions(ctx context.Context) (err error) {
321
318
return nil
322
319
}
323
320
324
- func (issue * Issue ) loadForeignReference (ctx context.Context ) (err error ) {
325
- if issue .ForeignReference != nil {
326
- return nil
327
- }
328
- reference := & foreignreference.ForeignReference {
329
- RepoID : issue .RepoID ,
330
- LocalIndex : issue .Index ,
331
- Type : foreignreference .TypeIssue ,
332
- }
333
- has , err := db .GetEngine (ctx ).Get (reference )
334
- if err != nil {
335
- return err
336
- } else if ! has {
337
- return foreignreference.ErrForeignIndexNotExist {
338
- RepoID : issue .RepoID ,
339
- LocalIndex : issue .Index ,
340
- Type : foreignreference .TypeIssue ,
341
- }
342
- }
343
- issue .ForeignReference = reference
344
- return nil
345
- }
346
-
347
321
// LoadMilestone load milestone of this issue.
348
322
func (issue * Issue ) LoadMilestone (ctx context.Context ) (err error ) {
349
323
if (issue .Milestone == nil || issue .Milestone .ID != issue .MilestoneID ) && issue .MilestoneID > 0 {
@@ -406,10 +380,6 @@ func (issue *Issue) LoadAttributes(ctx context.Context) (err error) {
406
380
}
407
381
}
408
382
409
- if err = issue .loadForeignReference (ctx ); err != nil && ! foreignreference .IsErrForeignIndexNotExist (err ) {
410
- return err
411
- }
412
-
413
383
return issue .loadReactions (ctx )
414
384
}
415
385
@@ -1097,26 +1067,6 @@ func GetIssueByIndex(repoID, index int64) (*Issue, error) {
1097
1067
return issue , nil
1098
1068
}
1099
1069
1100
- // GetIssueByForeignIndex returns raw issue by foreign ID
1101
- func GetIssueByForeignIndex (ctx context.Context , repoID , foreignIndex int64 ) (* Issue , error ) {
1102
- reference := & foreignreference.ForeignReference {
1103
- RepoID : repoID ,
1104
- ForeignIndex : strconv .FormatInt (foreignIndex , 10 ),
1105
- Type : foreignreference .TypeIssue ,
1106
- }
1107
- has , err := db .GetEngine (ctx ).Get (reference )
1108
- if err != nil {
1109
- return nil , err
1110
- } else if ! has {
1111
- return nil , foreignreference.ErrLocalIndexNotExist {
1112
- RepoID : repoID ,
1113
- ForeignIndex : foreignIndex ,
1114
- Type : foreignreference .TypeIssue ,
1115
- }
1116
- }
1117
- return GetIssueByIndex (repoID , reference .LocalIndex )
1118
- }
1119
-
1120
1070
// GetIssueWithAttrsByIndex returns issue by index in a repository.
1121
1071
func GetIssueWithAttrsByIndex (repoID , index int64 ) (* Issue , error ) {
1122
1072
issue , err := GetIssueByIndex (repoID , index )
0 commit comments