summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/pipeline_editor/components/commit/commit_section.vue
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/pipeline_editor/components/commit/commit_section.vue')
-rw-r--r--app/assets/javascripts/pipeline_editor/components/commit/commit_section.vue16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/assets/javascripts/pipeline_editor/components/commit/commit_section.vue b/app/assets/javascripts/pipeline_editor/components/commit/commit_section.vue
index 567164cb0ee..8f4894a0bde 100644
--- a/app/assets/javascripts/pipeline_editor/components/commit/commit_section.vue
+++ b/app/assets/javascripts/pipeline_editor/components/commit/commit_section.vue
@@ -8,6 +8,8 @@ import {
COMMIT_SUCCESS,
} from '../../constants';
import commitCIFile from '../../graphql/mutations/commit_ci_file.mutation.graphql';
+import updateCurrentBranchMutation from '../../graphql/mutations/update_current_branch.mutation.graphql';
+import updateLastCommitBranchMutation from '../../graphql/mutations/update_last_commit_branch.mutation.graphql';
import getCommitSha from '../../graphql/queries/client/commit_sha.graphql';
import getCurrentBranch from '../../graphql/queries/client/current_branch.graphql';
import getIsNewCiConfigFile from '../../graphql/queries/client/is_new_ci_config_file.graphql';
@@ -113,6 +115,8 @@ export default {
this.redirectToNewMergeRequest(targetBranch);
} else {
this.$emit('commit', { type: COMMIT_SUCCESS });
+ this.updateLastCommitBranch(targetBranch);
+ this.updateCurrentBranch(targetBranch);
}
} catch (error) {
this.$emit('showError', { type: COMMIT_FAILURE, reasons: [error?.message] });
@@ -123,6 +127,18 @@ export default {
onCommitCancel() {
this.$emit('resetContent');
},
+ updateCurrentBranch(currentBranch) {
+ this.$apollo.mutate({
+ mutation: updateCurrentBranchMutation,
+ variables: { currentBranch },
+ });
+ },
+ updateLastCommitBranch(lastCommitBranch) {
+ this.$apollo.mutate({
+ mutation: updateLastCommitBranchMutation,
+ variables: { lastCommitBranch },
+ });
+ },
},
};
</script>