code.gitea.io/gitea@v1.19.3/modules/migration/issue.go (about)

     1  // Copyright 2019 The Gitea Authors. All rights reserved.
     2  // Copyright 2018 Jonas Franz. All rights reserved.
     3  // SPDX-License-Identifier: MIT
     4  
     5  package migration
     6  
     7  import "time"
     8  
     9  // Issue is a standard issue information
    10  type Issue struct {
    11  	Number       int64             `json:"number"`
    12  	PosterID     int64             `yaml:"poster_id" json:"poster_id"`
    13  	PosterName   string            `yaml:"poster_name" json:"poster_name"`
    14  	PosterEmail  string            `yaml:"poster_email" json:"poster_email"`
    15  	Title        string            `json:"title"`
    16  	Content      string            `json:"content"`
    17  	Ref          string            `json:"ref"`
    18  	Milestone    string            `json:"milestone"`
    19  	State        string            `json:"state"` // closed, open
    20  	IsLocked     bool              `yaml:"is_locked" json:"is_locked"`
    21  	Created      time.Time         `json:"created"`
    22  	Updated      time.Time         `json:"updated"`
    23  	Closed       *time.Time        `json:"closed"`
    24  	Labels       []*Label          `json:"labels"`
    25  	Reactions    []*Reaction       `json:"reactions"`
    26  	Assignees    []string          `json:"assignees"`
    27  	ForeignIndex int64             `json:"foreign_id"`
    28  	Context      DownloaderContext `yaml:"-"`
    29  }
    30  
    31  // GetExternalName ExternalUserMigrated interface
    32  func (issue *Issue) GetExternalName() string { return issue.PosterName }
    33  
    34  // GetExternalID ExternalUserMigrated interface
    35  func (issue *Issue) GetExternalID() int64 { return issue.PosterID }
    36  
    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  
    48  func (issue *Issue) GetContext() DownloaderContext { return issue.Context }