|
|
|
@ -79,27 +79,35 @@ func retrieveRepoIssueMetaData(ctx *context.Context, repo *repo_model.Repository
|
|
|
|
|
return data
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data.CanModifyIssueOrPull = ctx.Repo.CanWriteIssuesOrPulls(isPull) && !ctx.Repo.Repository.IsArchived
|
|
|
|
|
if !data.CanModifyIssueOrPull {
|
|
|
|
|
// it sets "Branches" template data,
|
|
|
|
|
// it is used to render the "edit PR target branches" dropdown, and the "branch selector" in the issue's sidebar.
|
|
|
|
|
PrepareBranchList(ctx)
|
|
|
|
|
if ctx.Written() {
|
|
|
|
|
return data
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data.retrieveAssigneesDataForIssueWriter(ctx)
|
|
|
|
|
// it sets the "Assignees" template data, and the data is also used to "mention" users.
|
|
|
|
|
data.retrieveAssigneesData(ctx)
|
|
|
|
|
if ctx.Written() {
|
|
|
|
|
return data
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data.retrieveMilestonesDataForIssueWriter(ctx)
|
|
|
|
|
if ctx.Written() {
|
|
|
|
|
// TODO: the issue/pull permissions are quite complex and unclear
|
|
|
|
|
// A reader could create an issue/PR with setting some meta (eg: assignees from issue template, reviewers, target branch)
|
|
|
|
|
// A reader(creator) could update some meta (eg: target branch), but can't change assignees anymore.
|
|
|
|
|
// For non-creator users, only writers could update some meta (eg: assignees, milestone, project)
|
|
|
|
|
// Need to clarify the logic and add some tests in the future
|
|
|
|
|
data.CanModifyIssueOrPull = ctx.Repo.CanWriteIssuesOrPulls(isPull) && !ctx.Repo.Repository.IsArchived
|
|
|
|
|
if !data.CanModifyIssueOrPull {
|
|
|
|
|
return data
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data.retrieveProjectsDataForIssueWriter(ctx)
|
|
|
|
|
data.retrieveMilestonesDataForIssueWriter(ctx)
|
|
|
|
|
if ctx.Written() {
|
|
|
|
|
return data
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PrepareBranchList(ctx)
|
|
|
|
|
data.retrieveProjectsDataForIssueWriter(ctx)
|
|
|
|
|
if ctx.Written() {
|
|
|
|
|
return data
|
|
|
|
|
}
|
|
|
|
@ -131,7 +139,7 @@ func (d *IssuePageMetaData) retrieveMilestonesDataForIssueWriter(ctx *context.Co
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (d *IssuePageMetaData) retrieveAssigneesDataForIssueWriter(ctx *context.Context) {
|
|
|
|
|
func (d *IssuePageMetaData) retrieveAssigneesData(ctx *context.Context) {
|
|
|
|
|
var err error
|
|
|
|
|
d.AssigneesData.CandidateAssignees, err = repo_model.GetRepoAssignees(ctx, d.Repository)
|
|
|
|
|
if err != nil {
|
|
|
|
|