summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2023-05-24 23:36:02 +0200
committerGitHub <noreply@github.com>2023-05-24 21:36:02 +0000
commit1bfa37ada21a0f18baa53227d7748c365e0f90b2 (patch)
treeb476d9d7bd89525ca6cee3e80c9f8b482fe94e9f /templates
parent1cf4d46bb194f236b3e0157bc2ec2583014cfa2e (diff)
downloadgitea-1bfa37ada21a0f18baa53227d7748c365e0f90b2.tar.gz
gitea-1bfa37ada21a0f18baa53227d7748c365e0f90b2.zip
Create pull request for base after editing file, if not enabled on fork (#24841)
Currently if pull requests are disabled on a fork but enabled on a base repo, creating/editing/deleting files does not offer the option to create a pull request. This change enables creating a pull request for the base repo in that case. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'templates')
-rw-r--r--templates/repo/editor/commit_form.tmpl6
1 files changed, 2 insertions, 4 deletions
diff --git a/templates/repo/editor/commit_form.tmpl b/templates/repo/editor/commit_form.tmpl
index db798d92e8..6a3f86f9fc 100644
--- a/templates/repo/editor/commit_form.tmpl
+++ b/templates/repo/editor/commit_form.tmpl
@@ -41,17 +41,15 @@
</div>
{{if not .Repository.IsEmpty}}
<div class="field">
- {{$pullRequestEnabled := .Repository.UnitEnabled $.Context $.UnitTypePullRequests}}
- {{$prUnit := .Repository.MustGetUnit $.Context $.UnitTypePullRequests}}
<div class="ui radio checkbox">
- {{if $pullRequestEnabled}}
+ {{if .CanCreatePullRequest}}
<input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="commit-to-new-branch" button_text="{{.locale.Tr "repo.editor.propose_file_change"}}" {{if eq .commit_choice "commit-to-new-branch"}}checked{{end}}>
{{else}}
<input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="commit-to-new-branch" button_text="{{.locale.Tr "repo.editor.commit_changes"}}" {{if eq .commit_choice "commit-to-new-branch"}}checked{{end}}>
{{end}}
<label>
{{svg "octicon-git-pull-request"}}
- {{if $pullRequestEnabled}}
+ {{if .CanCreatePullRequest}}
{{.locale.Tr "repo.editor.create_new_branch" | Safe}}
{{else}}
{{.locale.Tr "repo.editor.create_new_branch_np" | Safe}}