Browse Source

public: minor fix for PR #5276

Unknwon 6 years ago
parent
commit
f6bdefe3f3

+ 1 - 1
gogs.go

@@ -16,7 +16,7 @@ import (
 	"github.com/gogs/gogs/pkg/setting"
 )
 
-const APP_VER = "0.11.58.0625"
+const APP_VER = "0.11.59.0626"
 
 func init() {
 	setting.AppVer = APP_VER

+ 2 - 2
models/pull.go

@@ -193,7 +193,7 @@ const (
 
 // Merge merges pull request to base repository.
 // FIXME: add repoWorkingPull make sure two merges does not happen at same time.
-func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle MergeStyle, CommitDescription string) (err error) {
+func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle MergeStyle, commitDescription string) (err error) {
 	defer func() {
 		go HookQueue.Add(pr.BaseRepo.ID)
 		go AddTestPullRequestTask(doer, pr.BaseRepo.ID, pr.BaseBranch, false)
@@ -267,7 +267,7 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle
 			fmt.Sprintf("PullRequest.Merge (git merge): %s", tmpBasePath),
 			"git", "commit", fmt.Sprintf("--author='%s <%s>'", sig.Name, sig.Email),
 			"-m", fmt.Sprintf("Merge branch '%s' of %s/%s into %s", pr.HeadBranch, pr.HeadUserName, pr.HeadRepo.Name, pr.BaseBranch),
-			"-m", CommitDescription); err != nil {
+			"-m", commitDescription); err != nil {
 			return fmt.Errorf("git commit [%s]: %v - %s", tmpBasePath, err, stderr)
 		}
 

File diff suppressed because it is too large
+ 0 - 0
pkg/bindata/bindata.go


+ 3 - 0
public/css/gogs.css

@@ -1731,6 +1731,9 @@ footer .ui.language .menu {
   margin-left: 10px;
   margin-top: 10px;
 }
+.repository.view.issue .pull .merge.box #commit_description {
+  height: auto;
+}
 .repository.view.issue .comment-list:before {
   display: block;
   content: "";

+ 12 - 3
public/js/gogs.js

@@ -111,7 +111,7 @@ function initCommentForm() {
     // This should be added directly to HTML but somehow just get empty <span> on this page.
     $labelMenu.find('.item:not(.no-select) .octicon:not(.octicon-check)').each(function () {
         $(this).html('&nbsp;');
-    })
+    });
     $labelMenu.find('.item:not(.no-select)').click(function () {
         if ($(this).hasClass('checked')) {
             $(this).removeClass('checked');
@@ -499,6 +499,15 @@ function initRepository() {
     if ($('.repository.compare.pull').length > 0) {
         initFilterSearchDropdown('.choose.branch .dropdown');
     }
+    if ($('.repository.view.pull').length > 0) {
+    	$('.comment.merge.box input[name=merge_style]').change(function () {
+    		if ($(this).val() === 'create_merge_commit') {
+				$('.commit.description.field').show();
+			} else {
+				$('.commit.description.field').hide();
+			}
+		})
+	}
 }
 
 function initWikiForm() {
@@ -1143,7 +1152,7 @@ function initWebhookSettings() {
 $(document).ready(function () {
     csrf = $('meta[name=_csrf]').attr("content");
     suburl = $('meta[name=_suburl]').attr("content");
-    
+
     // Set cursor to the end of autofocus input string
     $('input[autofocus]').each(function () {
         $(this).val($(this).val());
@@ -1469,7 +1478,7 @@ function getByteLen(normalVal) {
 }
 
 function showMessageMaxLength(maxLen, textElemId, counterId) {
-    var $msg = $('#'+textElemId);                      
+    var $msg = $('#'+textElemId);
     $('#'+counterId).html(maxLen - getByteLen($msg.val()));
 
     var onMessageKey = function (e) {

+ 3 - 0
public/less/_repository.less

@@ -639,6 +639,9 @@
 					margin-left: 10px;
 					margin-top: 10px;
 				}
+				#commit_description {
+					height: auto;
+				}
 			}
 		}
 		.comment-list {

+ 1 - 1
templates/.VERSION

@@ -1 +1 @@
-0.11.58.0625
+0.11.59.0626

+ 6 - 6
templates/repo/issue/view_content.tmpl

@@ -195,12 +195,6 @@
 									<div class="ui divider"></div>
 									<form class="ui form" action="{{.Link}}/merge" method="post">
 										{{.CSRFTokenHTML}}
-										<div class="field">
-											<div class="ui top">
-												<label>{{$.i18n.Tr "repo.pulls.commit_description"}}:</label>
-												<textarea id="commit_description" class="edit_area" name="commit_description" tabindex="4"></textarea>
-											</div>
-										</div>
 										<div class="field">
 											<div class="ui radio checkbox">
 											  <input type="radio" name="merge_style" value="create_merge_commit" checked="checked">
@@ -215,6 +209,12 @@
 												</div>
 											</div>
 										{{end}}
+										<div class="commit description field">
+											<div class="ui top">
+												<p>{{$.i18n.Tr "repo.pulls.commit_description"}}:</p>
+												<textarea id="commit_description" name="commit_description" tabindex="4" rows="3"></textarea>
+											</div>
+										</div>
 										<button class="ui green button">
 											<span class="octicon octicon-git-merge"></span> {{$.i18n.Tr "repo.pulls.merge_pull_request"}}
 										</button>

Some files were not shown because too many files changed in this diff