Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Schatz <jschatz1@gmail.com>2017-10-13 00:24:31 +0300
committerJacob Schatz <jschatz1@gmail.com>2017-10-13 00:24:31 +0300
commit1fab12cd1e4b026b278ba3231c1cd98d3cf473fd (patch)
treef21299f69adfc1a589eefae5dc8a928797a571e7
parent408d7c06fc0a2ea2fe2ad120b738ab21211e0c80 (diff)
Move `tryCommit`
-rw-r--r--app/assets/javascripts/repo/components/repo_commit_section.vue55
1 files changed, 28 insertions, 27 deletions
diff --git a/app/assets/javascripts/repo/components/repo_commit_section.vue b/app/assets/javascripts/repo/components/repo_commit_section.vue
index 56a74fd385c..bd8d29989a7 100644
--- a/app/assets/javascripts/repo/components/repo_commit_section.vue
+++ b/app/assets/javascripts/repo/components/repo_commit_section.vue
@@ -42,35 +42,36 @@ export default {
}
},
- tryCommit(e, skipBranchCheck = false, newBranch = false) {
- const makeCommit = () => {
- // see https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
- const commitMessage = this.commitMessage;
- const actions = this.changedFiles.map(f => ({
- action: 'update',
- file_path: f.path,
- content: f.newContent,
- }));
- const branch = newBranch ? `${this.currentBranch}-${this.currentShortHash}` : this.currentBranch;
- const payload = {
- branch,
- commit_message: commitMessage,
- actions,
- };
- if (newBranch) {
- payload.start_branch = this.currentBranch;
- }
- this.submitCommitsLoading = true;
- Service.commitFiles(payload)
- .then(() => {
- this.reloadPage(branch);
- this.$emit('tryCommit:complete');
- })
- .catch(this.commitError);
+ makeCommit(newBranch) {
+ // see https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
+ const commitMessage = this.commitMessage;
+ const actions = this.changedFiles.map(f => ({
+ action: 'update',
+ file_path: f.path,
+ content: f.newContent,
+ }));
+ const branch = newBranch ? `${this.currentBranch}-${this.currentShortHash}` : this.currentBranch;
+ const payload = {
+ branch,
+ commit_message: commitMessage,
+ actions,
};
+ if (newBranch) {
+ payload.start_branch = this.currentBranch;
+ }
+ this.submitCommitsLoading = true;
+ Service.commitFiles(payload)
+ .then(() => {
+ this.reloadPage(branch);
+ this.$emit('tryCommit:complete');
+ })
+ .catch(this.commitError);
+ },
+
+ tryCommit(e, skipBranchCheck = false, newBranch = false) {
if (skipBranchCheck) {
- makeCommit();
+ this.makeCommit(newBranch);
} else {
Store.setBranchHash()
.then(() => {
@@ -79,7 +80,7 @@ export default {
this.$emit('showBranchChangeDialog:enabled');
return;
}
- makeCommit();
+ this.makeCommit(newBranch);
})
.catch(this.commitError);
}