@@ -79,27 +79,35 @@ func retrieveRepoIssueMetaData(ctx *context.Context, repo *repo_model.Repository
79
79
return data
80
80
}
81
81
82
- data .CanModifyIssueOrPull = ctx .Repo .CanWriteIssuesOrPulls (isPull ) && ! ctx .Repo .Repository .IsArchived
83
- if ! data .CanModifyIssueOrPull {
82
+ // it sets "Branches" template data,
83
+ // it is used to render the "edit PR target branches" dropdown, and the "branch selector" in the issue's sidebar.
84
+ PrepareBranchList (ctx )
85
+ if ctx .Written () {
84
86
return data
85
87
}
86
88
87
- data .retrieveAssigneesDataForIssueWriter (ctx )
89
+ // it sets the "Assignees" template data, and the data is also used to "mention" users.
90
+ data .retrieveAssigneesData (ctx )
88
91
if ctx .Written () {
89
92
return data
90
93
}
91
94
92
- data .retrieveMilestonesDataForIssueWriter (ctx )
93
- if ctx .Written () {
95
+ // TODO: the issue/pull permissions are quite complex and unclear
96
+ // A reader could create an issue/PR with setting some meta (eg: assignees from issue template, reviewers, target branch)
97
+ // A reader(creator) could update some meta (eg: target branch), but can't change assignees anymore.
98
+ // For non-creator users, only writers could update some meta (eg: assignees, milestone, project)
99
+ // Need to clarify the logic and add some tests in the future
100
+ data .CanModifyIssueOrPull = ctx .Repo .CanWriteIssuesOrPulls (isPull ) && ! ctx .Repo .Repository .IsArchived
101
+ if ! data .CanModifyIssueOrPull {
94
102
return data
95
103
}
96
104
97
- data .retrieveProjectsDataForIssueWriter (ctx )
105
+ data .retrieveMilestonesDataForIssueWriter (ctx )
98
106
if ctx .Written () {
99
107
return data
100
108
}
101
109
102
- PrepareBranchList (ctx )
110
+ data . retrieveProjectsDataForIssueWriter (ctx )
103
111
if ctx .Written () {
104
112
return data
105
113
}
@@ -131,7 +139,7 @@ func (d *IssuePageMetaData) retrieveMilestonesDataForIssueWriter(ctx *context.Co
131
139
}
132
140
}
133
141
134
- func (d * IssuePageMetaData ) retrieveAssigneesDataForIssueWriter (ctx * context.Context ) {
142
+ func (d * IssuePageMetaData ) retrieveAssigneesData (ctx * context.Context ) {
135
143
var err error
136
144
d .AssigneesData .CandidateAssignees , err = repo_model .GetRepoAssignees (ctx , d .Repository )
137
145
if err != nil {
0 commit comments