@@ -2598,13 +2598,20 @@ webui.NewChangedFilesView = function(workspaceView) {
25982598 } ) ;
25992599 $ ( "#commitBtn" ) . off ( "click" ) ;
26002600 $ ( "#commitBtn" ) . on ( "click" , function ( ) {
2601- if ( selectedItemsFromOtherUser . length > 0 ) {
2602- self . confirmActionOnOtherUsersChanges ( "commit" ) ;
2603- } else {
2604- var commitMessage = $ ( '#commitMsg' ) . val ( ) ;
2605- self . commit ( commitMessage , $ ( "#commitMsgDetail" ) . val ( ) ) ;
2606- }
2607-
2601+ // Make sure we are not commiting to default merge branch in basic mode
2602+ $ . get ( "api/basic-and-default" , function ( data ) {
2603+ var basicAndDefault = JSON . parse ( data ) [ "basic-and-default" ]
2604+ if ( basicAndDefault == "1" ) {
2605+ self . noCommitsOnDefault ( ) ;
2606+ } else {
2607+ if ( selectedItemsFromOtherUser . length > 0 ) {
2608+ self . confirmActionOnOtherUsersChanges ( "commit" ) ;
2609+ } else {
2610+ var commitMessage = $ ( '#commitMsg' ) . val ( ) ;
2611+ self . commit ( commitMessage , $ ( "#commitMsgDetail" ) . val ( ) ) ;
2612+ }
2613+ }
2614+ } )
26082615 } ) ;
26092616
26102617 $ ( "#amendBtn" ) . off ( "click" ) ;
@@ -2749,6 +2756,55 @@ webui.NewChangedFilesView = function(workspaceView) {
27492756 } ) ;
27502757 }
27512758
2759+ // Popup for when trying to commit to default merge branch in basic mode
2760+ self . noCommitsOnDefault = function ( ) {
2761+ function removePopup ( popup ) {
2762+ $ ( popup ) . children ( ".modal-fade" ) . modal ( "hide" ) ;
2763+ $ ( ".modal-backdrop" ) . remove ( ) ;
2764+ $ ( "#noCommitsDefault" ) . remove ( ) ;
2765+ }
2766+
2767+ var popup = $ (
2768+ '<div class="modal fade" tabindex="-1" id="noCommitsDefault" role="dialog" data-backdrop="static">' +
2769+ '<div class="modal-dialog modal-md" role="document">' +
2770+ '<div class="modal-content">' +
2771+ '<div class="modal-header">' +
2772+ '<h5 class="modal-title">Cannot commit to Default Branch</h5>' +
2773+ '<button type="button" class="btn btn-default close" data-dismiss="modal">' + webui . largeXIcon + '</button>' +
2774+ '</div>' +
2775+ '<div class="modal-body">' +
2776+ '<div class="row">' +
2777+ '<div class="col-sm-1">' +
2778+ webui . warningIcon +
2779+ '</div>' +
2780+ '<div class="col-sm-11">' +
2781+ '<p>You cannot commit directly to the default merge branch while using basic mode. Please switch to another branch.</p>' +
2782+ '</div>' +
2783+ '</div>' +
2784+ '</div>' +
2785+ '<div class="modal-footer"></div>' +
2786+ '</div>' +
2787+ '</div>' +
2788+ '</div>'
2789+ ) [ 0 ] ;
2790+
2791+ $ ( "body" ) . append ( popup ) ;
2792+
2793+ var popupFooter = $ ( ".modal-footer" , popup ) [ 0 ] ;
2794+ webui . detachChildren ( popupFooter ) ;
2795+
2796+ $ (
2797+ '<button class="btn btn-sm btn-secondary action-btn" id="noCommitDefaultButton">Ok</button>'
2798+ ) . appendTo ( popupFooter ) ;
2799+
2800+ $ ( popup ) . modal ( 'show' ) ;
2801+
2802+ $ ( "#noCommitsDefault" ) . find ( ".close, #noCommitDefaultButton" ) . click ( function ( ) {
2803+ removePopup ( popup ) ;
2804+ } )
2805+
2806+ } ;
2807+
27522808 self . confirmActionOnOtherUsersChanges = function ( action ) {
27532809 function removeWarningModal ( popup ) {
27542810 $ ( popup ) . children ( ".modal-fade" ) . modal ( "hide" ) ;
0 commit comments