diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl
index 5740b79adb..ba15539841 100644
--- a/templates/repo/issue/view_content/sidebar.tmpl
+++ b/templates/repo/issue/view_content/sidebar.tmpl
@@ -52,7 +52,15 @@
 		{{template "repo/issue/view_content/sidebar/actions" .}}
 	{{end}}
 
-	{{if and .Issue.IsPull .IsIssuePoster (not .Issue.IsClosed) .Issue.PullRequest.HeadRepo}}
+	{{if and
+		.Issue.IsPull
+		.IsIssuePoster
+		(not .Issue.IsClosed)
+		.Issue.PullRequest.HeadRepo
+		(not (eq .Issue.PullRequest.HeadRepo.FullName .Issue.PullRequest.BaseRepo.FullName))
+		.CanWriteToHeadRepo
+	}}
+		<div class="divider"></div>
 		{{template "repo/issue/view_content/sidebar/pull_maintainer_edits" .}}
 	{{end}}
 </div>
diff --git a/templates/repo/issue/view_content/sidebar/pull_maintainer_edits.tmpl b/templates/repo/issue/view_content/sidebar/pull_maintainer_edits.tmpl
index c6a87adde4..6ec5c05fd7 100644
--- a/templates/repo/issue/view_content/sidebar/pull_maintainer_edits.tmpl
+++ b/templates/repo/issue/view_content/sidebar/pull_maintainer_edits.tmpl
@@ -1,13 +1,10 @@
-{{if and (not (eq .Issue.PullRequest.HeadRepo.FullName .Issue.PullRequest.BaseRepo.FullName)) .CanWriteToHeadRepo}}
-	<div class="divider"></div>
-	<div class="inline field">
-		<div class="ui checkbox loading-icon-2px" id="allow-edits-from-maintainers"
-				data-url="{{.Issue.Link}}"
-				data-tooltip-content="{{ctx.Locale.Tr "repo.pulls.allow_edits_from_maintainers_desc"}}"
-				data-prompt-error="{{ctx.Locale.Tr "repo.pulls.allow_edits_from_maintainers_err"}}"
-			>
-			<label><strong>{{ctx.Locale.Tr "repo.pulls.allow_edits_from_maintainers"}}</strong></label>
-			<input type="checkbox" {{if .Issue.PullRequest.AllowMaintainerEdit}}checked{{end}}>
-		</div>
+<div class="inline field">
+	<div class="ui checkbox loading-icon-2px" id="allow-edits-from-maintainers"
+			data-url="{{.Issue.Link}}"
+			data-tooltip-content="{{ctx.Locale.Tr "repo.pulls.allow_edits_from_maintainers_desc"}}"
+			data-prompt-error="{{ctx.Locale.Tr "repo.pulls.allow_edits_from_maintainers_err"}}"
+		>
+		<label><strong>{{ctx.Locale.Tr "repo.pulls.allow_edits_from_maintainers"}}</strong></label>
+		<input type="checkbox" {{if .Issue.PullRequest.AllowMaintainerEdit}}checked{{end}}>
 	</div>
-{{end}}
+</div>