|
565 | 565 | snapshot.snapshotEditContainerDisplayed.set( false );
|
566 | 566 |
|
567 | 567 | api.state( 'snapshot-saved' ).bind( function( saved ) {
|
568 |
| - if ( saved ) { |
| 568 | + if ( saved && ! snapshot.dirtyEditControlValues ) { |
569 | 569 | snapshot.updateSnapshotEditControls();
|
570 | 570 | }
|
571 | 571 | } );
|
|
611 | 611 | }
|
612 | 612 | snapshot.updatePending = true;
|
613 | 613 | snapshot.editBoxAutoSaveTriggered = true;
|
| 614 | + snapshot.dirtyEditControlValues = false; |
614 | 615 | snapshot.updateSnapshot( status ).done( function() {
|
615 | 616 | snapshot.updatePending = snapshot.dirtyEditControlValues;
|
616 | 617 | if ( ! snapshot.updatePending ) {
|
|
621 | 622 | snapshot.dirtyEditControlValues = false;
|
622 | 623 | } ).fail( function() {
|
623 | 624 | snapshot.updatePending = false;
|
| 625 | + snapshot.dirtyEditControlValues = true; |
624 | 626 | } );
|
625 | 627 | }, delay );
|
626 | 628 |
|
627 | 629 | snapshot.editControlSettings( 'title' ).bind( function() {
|
| 630 | + snapshot.dirtyEditControlValues = true; |
628 | 631 | if ( ! snapshot.updatePending ) {
|
629 | 632 | update();
|
630 |
| - } else { |
631 |
| - snapshot.dirtyEditControlValues = true; |
632 | 633 | }
|
633 | 634 | } );
|
634 | 635 |
|
635 | 636 | snapshot.editControlSettings( 'date' ).bind( function() {
|
636 | 637 | if ( snapshot.isFutureDate() ) {
|
| 638 | + snapshot.dirtyEditControlValues = true; |
637 | 639 | if ( ! snapshot.updatePending ) {
|
638 | 640 | update();
|
639 |
| - } else { |
640 |
| - snapshot.dirtyEditControlValues = true; |
641 | 641 | }
|
642 | 642 | }
|
643 | 643 | } );
|
|
656 | 656 | // @todo Show loader and disable button while auto saving.
|
657 | 657 | api.bind( 'changeset-save', function() {
|
658 | 658 | if ( isValidChangesetStatus() ) {
|
659 |
| - snapshot.updatePending = true; |
660 | 659 | snapshot.extendPreviewerQuery();
|
661 | 660 | }
|
662 | 661 | } );
|
663 | 662 |
|
664 | 663 | api.bind( 'changeset-saved', function() {
|
665 |
| - api.state( 'saved' ).set( true ); // Suppress the AYS dialog. |
666 |
| - |
667 |
| - if ( isValidChangesetStatus() ) { |
668 |
| - snapshot.updatePending = false; |
| 664 | + if ( 'auto-draft' === api.state( 'changesetStatus' ).get() ) { |
| 665 | + api.state( 'saved' ).set( true ); // Suppress the AYS dialog. |
669 | 666 | }
|
670 | 667 | });
|
671 | 668 | },
|
|
0 commit comments