mirror of
https://github.com/go-gitea/gitea
synced 2025-02-19 08:47:05 +01:00
parent
5e9cc919cf
commit
d17f8ffcc1
@ -79,16 +79,29 @@ 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
|
||||
}
|
||||
|
||||
// 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.retrieveMilestonesDataForIssueWriter(ctx)
|
||||
if ctx.Written() {
|
||||
return data
|
||||
@ -99,11 +112,6 @@ func retrieveRepoIssueMetaData(ctx *context.Context, repo *repo_model.Repository
|
||||
return data
|
||||
}
|
||||
|
||||
PrepareBranchList(ctx)
|
||||
if ctx.Written() {
|
||||
return data
|
||||
}
|
||||
|
||||
ctx.Data["CanCreateIssueDependencies"] = ctx.Repo.CanCreateIssueDependencies(ctx, ctx.Doer, isPull)
|
||||
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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user