mirror of
https://gitea.com/gitea/tea
synced 2024-11-23 00:12:05 +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
|
// 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
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ func promptIssueProperties(login *config.Login, owner, repo string, o *gitea.Cre
|
|||||||
|
|
||||||
type issueSelectables struct {
|
type issueSelectables struct {
|
||||||
Repo *gitea.Repository
|
Repo *gitea.Repository
|
||||||
Collaborators []string
|
Assignees []string
|
||||||
MilestoneList []string
|
MilestoneList []string
|
||||||
MilestoneMap map[string]int64
|
MilestoneMap map[string]int64
|
||||||
LabelList []string
|
LabelList []string
|
||||||
@ -124,17 +124,15 @@ func fetchIssueSelectables(login *config.Login, owner, repo string, done chan is
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: this should ideally be ListAssignees(), https://github.com/go-gitea/gitea/issues/14856
|
assignees, _, err := c.GetAssignees(owner, repo)
|
||||||
colabs, _, err := c.ListCollaborators(owner, repo, gitea.ListCollaboratorsOptions{})
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
r.Err = err
|
r.Err = err
|
||||||
done <- r
|
done <- r
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
r.Collaborators = make([]string, len(colabs)+1)
|
r.Assignees = make([]string, len(assignees))
|
||||||
r.Collaborators[0] = login.User
|
for i, u := range assignees {
|
||||||
for i, u := range colabs {
|
r.Assignees[i] = u.UserName
|
||||||
r.Collaborators[i+1] = u.UserName
|
|
||||||
}
|
}
|
||||||
|
|
||||||
milestones, _, err := c.ListRepoMilestones(owner, repo, gitea.ListMilestoneOption{})
|
milestones, _, err := c.ListRepoMilestones(owner, repo, gitea.ListMilestoneOption{})
|
||||||
|
Loading…
Reference in New Issue
Block a user