Florianschmidtwelzow has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/200602

Change subject: Fix Next button for anonymous users
......................................................................

Fix Next button for anonymous users

Bug: T94419
Change-Id: I3b2da8e0887bc328c2244940673aa199d63ddf9f
---
M javascripts/modules/editor/EditorOverlay.js
M tests/qunit/modules/editor/test_EditorOverlay.js
2 files changed, 6 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/02/200602/1

diff --git a/javascripts/modules/editor/EditorOverlay.js 
b/javascripts/modules/editor/EditorOverlay.js
index e243732..23f9a15 100644
--- a/javascripts/modules/editor/EditorOverlay.js
+++ b/javascripts/modules/editor/EditorOverlay.js
@@ -36,7 +36,8 @@
                        loginCaption: mw.msg( 
'mobile-frontend-watchlist-cta-button-login' ),
                        signupCaption: mw.msg( 
'mobile-frontend-watchlist-cta-button-signup' ),
                        anonLabel: mw.msg( 'mobile-frontend-editor-anon' ),
-                       anonSelector: 'continue',
+                       // the "edit without logging in" link needs a second 
class to distinguish it with the "Next" button
+                       anonSelector: 'continue anonymous',
                        anonMsg: mw.msg( 'mobile-frontend-editor-anonwarning' )
                } ),
                editor: 'SourceEditor',
@@ -95,9 +96,9 @@
                /**
                 * @inheritdoc
                 */
-               onClickContinue: function () {
+               onClickContinue: function ( ev ) {
                        // handle the click on "Edit without logging in"
-                       if ( this.options.isAnon ) {
+                       if ( this.options.isAnon && $( ev.target ).hasClass( 
'anonymous' ) ) {
                                this._showEditorAfterWarning();
                                return false;
                        }
diff --git a/tests/qunit/modules/editor/test_EditorOverlay.js 
b/tests/qunit/modules/editor/test_EditorOverlay.js
index 82d58d1..a2306a6 100644
--- a/tests/qunit/modules/editor/test_EditorOverlay.js
+++ b/tests/qunit/modules/editor/test_EditorOverlay.js
@@ -72,12 +72,13 @@
                } ), 'initialize EditorApi without a section' );
        } );
 
-       QUnit.test( '#initialize, as anonymous', 1, function ( assert ) {
+       QUnit.test( '#initialize, as anonymous', 2, function ( assert ) {
                var editorOverlay = new EditorOverlay( {
                        title: 'Main_page',
                        isAnon: true
                } );
 
                assert.ok( editorOverlay.$anonWarning.length > 0, 
'Editorwarning (IP will be saved) visible.' );
+               assert.ok( editorOverlay.$( '.anonymous' ).length > 0, 
'Continue login has a second class.' );
        } );
 }( mw.mobileFrontend, jQuery ) );

-- 
To view, visit https://gerrit.wikimedia.org/r/200602
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b2da8e0887bc328c2244940673aa199d63ddf9f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.wel...@t-online.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to