mirror of
https://gitea.com/gitea/tea
synced 2024-11-22 16:02:01 +01:00
Interactive issue/pr posting: properly fetch assignees (#476)
Gitea 1.15.0 added a proper API for listing assignee candidates. imho that release is old enough that tea can start using this without workarounds. Co-authored-by: Norwin <git@nroo.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/476 Reviewed-by: techknowlogick <techknowlogick@gitea.io> Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Norwin <noerw@noreply.gitea.io> Co-committed-by: Norwin <noerw@noreply.gitea.io>
This commit is contained in:
parent
d8f4273ed0
commit
16ba594a28
@ -65,7 +65,7 @@ func promptIssueProperties(login *config.Login, owner, repo string, o *gitea.Cre
|
||||
}
|
||||
|
||||
// assignees
|
||||
if o.Assignees, err = promptMultiSelect("Assignees:", selectables.Collaborators, "[other]"); err != nil {
|
||||
if o.Assignees, err = promptMultiSelect("Assignees:", selectables.Assignees, "[other]"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ func promptIssueProperties(login *config.Login, owner, repo string, o *gitea.Cre
|
||||
|
||||
type issueSelectables struct {
|
||||
Repo *gitea.Repository
|
||||
Collaborators []string
|
||||
Assignees []string
|
||||
MilestoneList []string
|
||||
MilestoneMap map[string]int64
|
||||
LabelList []string
|
||||
@ -124,17 +124,15 @@ func fetchIssueSelectables(login *config.Login, owner, repo string, done chan is
|
||||
return
|
||||
}
|
||||
|
||||
// FIXME: this should ideally be ListAssignees(), https://github.com/go-gitea/gitea/issues/14856
|
||||
colabs, _, err := c.ListCollaborators(owner, repo, gitea.ListCollaboratorsOptions{})
|
||||
assignees, _, err := c.GetAssignees(owner, repo)
|
||||
if err != nil {
|
||||
r.Err = err
|
||||
done <- r
|
||||
return
|
||||
}
|
||||
r.Collaborators = make([]string, len(colabs)+1)
|
||||
r.Collaborators[0] = login.User
|
||||
for i, u := range colabs {
|
||||
r.Collaborators[i+1] = u.UserName
|
||||
r.Assignees = make([]string, len(assignees))
|
||||
for i, u := range assignees {
|
||||
r.Assignees[i] = u.UserName
|
||||
}
|
||||
|
||||
milestones, _, err := c.ListRepoMilestones(owner, repo, gitea.ListMilestoneOption{})
|
||||
|
Loading…
Reference in New Issue
Block a user