Skip to content

Commit

Permalink
fine tune and add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang committed Nov 9, 2024
1 parent 1759ea4 commit be102f5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
3 changes: 3 additions & 0 deletions routers/web/repo/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,9 @@ func CompareDiff(ctx *context.Context) {
if !nothingToCompare {
// Setup information for new form.
RetrieveRepoMetas(ctx, ctx.Repo.Repository, true)
if ctx.Written() {
return
}
RetrieveRepoReviewers(ctx, ctx.Repo.Repository, nil, true)
if ctx.Written() {
return
Expand Down
4 changes: 2 additions & 2 deletions routers/web/repo/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ func renderMilestones(ctx *context.Context) {
ctx.Data["ClosedMilestones"] = closedMilestones
}

// RetrieveRepoMilestonesAndAssignees find all the milestones, assignees, and reviewers of a repository
// RetrieveRepoMilestonesAndAssignees find all the milestones and assignees of a repository
func RetrieveRepoMilestonesAndAssignees(ctx *context.Context, repo *repo_model.Repository) {
var err error
ctx.Data["OpenMilestones"], err = db.Find[issues_model.Milestone](ctx, issues_model.FindMilestoneOptions{
Expand Down Expand Up @@ -676,7 +676,7 @@ type issueSidebarReviewersData struct {
CurrentPullReviewers []*repoReviewerSelection
}

// RetrieveRepoReviewers find all reviewers of a repository
// RetrieveRepoReviewers find all reviewers of a repository. If issue is nil, it means the doer is creating a new PR.
func RetrieveRepoReviewers(ctx *context.Context, repo *repo_model.Repository, issue *issues_model.Issue, canChooseReviewer bool) {
data := &issueSidebarReviewersData{}
data.RepoLink = ctx.Repo.RepoLink
Expand Down
8 changes: 4 additions & 4 deletions templates/repo/issue/sidebar/reviewer_list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
</div>
</div>

<div class="ui list flex-items-block">
<div class="ui relaxed list flex-items-block tw-my-4">
<span class="item empty-list {{if or $data.OriginalReviews $data.CurrentPullReviewers}}tw-hidden{{end}}">
{{ctx.Locale.Tr "repo.issues.new.no_reviewers"}}
</span>
Expand Down Expand Up @@ -81,7 +81,7 @@
</div>
</div>
{{end}}
{{range .OriginalReviews}}
{{range $data.OriginalReviews}}
<div class="item">
<div class="flex-text-inline tw-flex-1">
{{$originalURLHostname := $data.Repository.GetOriginalURLHostname}}
Expand Down Expand Up @@ -112,8 +112,8 @@
{{ctx.RootData.CsrfTokenHtml}}
<input type="hidden" class="reviewer-id" name="review_id">
<div class="field">
<label for="message">{{ctx.Locale.Tr "action.review_dismissed_reason"}}</label>
<input id="message" name="message">
<label for="issue-sidebar-dismiss-review-message">{{ctx.Locale.Tr "action.review_dismissed_reason"}}</label>
<input id="issue-sidebar-dismiss-review-message" name="message">
</div>
<div class="text right actions">
<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
Expand Down
1 change: 1 addition & 0 deletions web_src/css/repo.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
.issue-sidebar-combo .ui.dropdown .item:not(.checked) svg.octicon-check {
visibility: hidden;
}
/* ideally, we should move these styles to ".ui.dropdown .menu.flex-items-menu > .item ...", could be done later */
.issue-sidebar-combo .ui.dropdown .menu > .item > img,
.issue-sidebar-combo .ui.dropdown .menu > .item > svg {
margin: 0;
Expand Down
4 changes: 2 additions & 2 deletions web_src/js/features/repo-issue-sidebar-combolist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ export function initIssueSidebarComboList(container: HTMLElement) {
async onHide() {
const changedValues = collectCheckedValues(elDropdown);
if (updateUrl) {
await updateToBackend(changedValues);
await updateToBackend(changedValues); // send requests to backend and reload the page
} else {
syncList(changedValues);
syncList(changedValues); // only update the list in the sidebar
}
},
});
Expand Down

0 comments on commit be102f5

Please sign in to comment.