@@ -79,27 +79,35 @@ func retrieveRepoIssueMetaData(ctx *context.Context, repo *repo_model.Repository
7979 return data
8080 }
8181
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 () {
8486 return data
8587 }
8688
87- data .retrieveAssigneesDataForIssueWriter (ctx )
89+ // it sets the "Assignees" template data, and the data is also used to "mention" users.
90+ data .retrieveAssigneesData (ctx )
8891 if ctx .Written () {
8992 return data
9093 }
9194
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 {
94102 return data
95103 }
96104
97- data .retrieveProjectsDataForIssueWriter (ctx )
105+ data .retrieveMilestonesDataForIssueWriter (ctx )
98106 if ctx .Written () {
99107 return data
100108 }
101109
102- PrepareBranchList (ctx )
110+ data . retrieveProjectsDataForIssueWriter (ctx )
103111 if ctx .Written () {
104112 return data
105113 }
@@ -131,7 +139,7 @@ func (d *IssuePageMetaData) retrieveMilestonesDataForIssueWriter(ctx *context.Co
131139 }
132140}
133141
134- func (d * IssuePageMetaData ) retrieveAssigneesDataForIssueWriter (ctx * context.Context ) {
142+ func (d * IssuePageMetaData ) retrieveAssigneesData (ctx * context.Context ) {
135143 var err error
136144 d .AssigneesData .CandidateAssignees , err = repo_model .GetRepoAssignees (ctx , d .Repository )
137145 if err != nil {
0 commit comments