in backend/plugins/jira/tasks/apiv2models/issue.go [303:366]
func (i Issue) ExtractEntities(connectionId uint64, userFieldMaps map[string]struct{}) ([]uint64, *models.JiraIssue, []*models.JiraIssueComment, []*models.JiraWorklog, []*models.JiraIssueChangelogs, []*models.JiraIssueChangelogItems, []*models.JiraAccount) {
issue := i.toToolLayer(connectionId)
var comments []*models.JiraIssueComment
var worklogs []*models.JiraWorklog
var changelogs []*models.JiraIssueChangelogs
var changelogItems []*models.JiraIssueChangelogItems
var users []*models.JiraAccount
var sprints []uint64
if i.Fields.Comment.Total > 0 {
issue.CommentTotal = int64(i.Fields.Comment.Total)
var issueUpdated *time.Time
if len(i.Fields.Comment.Comments) <= i.Fields.Comment.Total {
issueUpdated = i.Fields.Updated.ToNullableTime()
}
for _, c := range i.Fields.Comment.Comments {
comments = append(comments, c.ToToolLayer(connectionId, i.ID, issueUpdated))
}
}
if i.Fields.Worklog != nil {
var issueUpdated *time.Time
if len(i.Fields.Worklog.Worklogs) <= i.Fields.Worklog.Total {
issueUpdated = i.Fields.Updated.ToNullableTime()
}
for _, w := range i.Fields.Worklog.Worklogs {
worklogs = append(worklogs, w.ToToolLayer(connectionId, issueUpdated))
}
}
if i.Changelog != nil {
var issueUpdated *time.Time
if len(i.Changelog.Histories) < 100 {
issueUpdated = i.Fields.Updated.ToNullableTime()
}
for _, changelog := range i.Changelog.Histories {
cl, user := changelog.ToToolLayer(connectionId, i.ID, issueUpdated)
changelogs = append(changelogs, cl)
if user != nil {
users = append(users, user)
}
for _, item := range changelog.Items {
changelogItems = append(changelogItems, item.ToToolLayer(connectionId, changelog.ID))
users = append(users, item.ExtractUser(connectionId, userFieldMaps)...)
}
}
}
if i.Fields.Sprint != nil {
sprints = append(sprints, i.Fields.Sprint.ID)
}
for _, sprint := range i.Fields.ClosedSprints {
sprints = append(sprints, sprint.ID)
}
if creator := i.Fields.Creator.ToToolLayer(connectionId); creator != nil {
users = append(users, creator)
}
if reporter := i.Fields.Reporter.ToToolLayer(connectionId); reporter != nil {
users = append(users, reporter)
}
if i.Fields.Assignee != nil {
if assignee := i.Fields.Assignee.ToToolLayer(connectionId); assignee != nil {
users = append(users, assignee)
}
}
return sprints, issue, comments, worklogs, changelogs, changelogItems, users
}