Skip to content
12 changes: 12 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,15 @@ issues:
linters:
- revive
text: "exported: type name will be used as user.UserBadge by other packages, and that stutters; consider calling this Badge"
- path: routers/web/repo/issue_priority.go
linters:
- dupl
- path: routers/web/repo/issue_label.go
linters:
- dupl
- path: models/issues/priority.go
linters:
- dupl
- path: models/issues/label.go
linters:
- dupl
15 changes: 10 additions & 5 deletions models/issues/comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ const (
CommentTypePRScheduledToAutoMerge
// 35 pr was un scheduled to auto merge when checks succeed
CommentTypePRUnScheduledToAutoMerge
// 35 Priority changed
CommentTypePriority
)

var commentStrings = []string{
Expand Down Expand Up @@ -225,6 +227,8 @@ type Comment struct {
Label *Label `xorm:"-"`
AddedLabels []*Label `xorm:"-"`
RemovedLabels []*Label `xorm:"-"`
PriorityID int64
Priority *Priority `xorm:"-"`
OldProjectID int64
ProjectID int64
OldProject *project_model.Project `xorm:"-"`
Expand Down Expand Up @@ -960,11 +964,12 @@ func createIssueDependencyComment(ctx context.Context, doer *user_model.User, is

// CreateCommentOptions defines options for creating comment
type CreateCommentOptions struct {
Type CommentType
Doer *user_model.User
Repo *repo_model.Repository
Issue *Issue
Label *Label
Type CommentType
Doer *user_model.User
Repo *repo_model.Repository
Issue *Issue
Label *Label
Priority *Priority

DependentIssueID int64
OldMilestoneID int64
Expand Down
15 changes: 14 additions & 1 deletion models/issues/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ type Issue struct {
MilestoneID int64 `xorm:"INDEX"`
Milestone *Milestone `xorm:"-"`
Project *project_model.Project `xorm:"-"`
Priority int
PriorityID int64
Priority *Priority `xorm:"-"`
AssigneeID int64 `xorm:"-"`
Assignee *user_model.User `xorm:"-"`
IsClosed bool `xorm:"INDEX"`
Expand Down Expand Up @@ -236,6 +237,17 @@ func (issue *Issue) LoadLabels(ctx context.Context) (err error) {
return nil
}

// LoadPriorities loads labels
func (issue *Issue) LoadPriorities(ctx context.Context) (err error) {
if issue.Priority == nil {
issue.Priority, err = GetPriorityByIssueID(ctx, issue.ID)
if err != nil {
return fmt.Errorf("getPriorityByIssueID [%d]: %v", issue.ID, err)
}
}
return nil
}

// LoadPoster loads poster
func (issue *Issue) LoadPoster() error {
return issue.loadPoster(db.DefaultContext)
Expand Down Expand Up @@ -1192,6 +1204,7 @@ type IssuesOptions struct { //nolint
IsClosed util.OptionalBool
IsPull util.OptionalBool
LabelIDs []int64
PriorityIDs []int64
IncludedLabelNames []string
ExcludedLabelNames []string
IncludeMilestones []string
Expand Down
Loading