jenkins-bot has submitted this change and it was merged.
Change subject: Fix no-redirecting Cta in Edit-workflow
......................................................................
Fix no-redirecting Cta in Edit-workflow
* use makeCta for all edit links
* remove out of place call to drawer.render()
* enable redirect to editor after login for all edit buttons
* Fixup false if/else handling of anonymous editing
Bug: 72580
Change-Id: Ia43fd0ddf35f2cfc26aecddf2bd3519f070c7494
---
M javascripts/modules/editor/editor.js
1 file changed, 23 insertions(+), 16 deletions(-)
Approvals:
Jdlrobson: Looks good to me, approved
jenkins-bot: Verified
diff --git a/javascripts/modules/editor/editor.js
b/javascripts/modules/editor/editor.js
index 191d595..a9675d5 100644
--- a/javascripts/modules/editor/editor.js
+++ b/javascripts/modules/editor/editor.js
@@ -47,6 +47,7 @@
returnto: mw.config.get( 'wgPageName' ),
returntoquery: 'action=edit§ion=' + section
} };
+
if ( allowAnonymous ) {
options.links = [ { label: mw.msg(
'mobile-frontend-editor-anon' ),
href: $el[0].href, selector: 'edit-anon
mw-ui-progressive' } ];
@@ -186,27 +187,33 @@
* @param {boolean} allowAnonymous Whether the drawer has to include an
edit anonymously link
*/
function initCta( allowAnonymous ) {
+ // If anonymous editing is allowed, init the editor now to be
useable for the "Edit w/o login" link in cta drawer
if ( allowAnonymous ) {
// init the editor
init( M.getCurrentPage() );
- } else {
- M.getCurrentPage().isEditable( user ).done( function (
isEditable ) {
- if ( isEditable ) {
- $( '#ca-edit' ).addClass( enabledClass
).removeClass( disabledClass ).
- on( 'tap', function () {
- drawer.render().show();
- } );
- } else {
- showSorryToast(
'mobile-frontend-editor-disabled' );
- }
- } );
}
- $( '.edit-page' ).each( function () {
- var $a = $( this ), section = 0;
- if ( $( this ).data( 'section' ) !== undefined ) {
- section = $( this ).data( 'section' );
+
+ // Initialize edit button links (to show Cta) only, if page is
editable, otherwise show an error toast
+ M.getCurrentPage().isEditable( user ).done( function (
isEditable ) {
+ if ( isEditable ) {
+ $( '#ca-edit' ).addClass( enabledClass
).removeClass( disabledClass );
+ // Init #ca-edit only, if anonymous editing is
disabled, if enabled, there is a link with .edit-page inside
+ if ( !allowAnonymous ) {
+ // Init lead section edit button
+ makeCta( $( '#ca-edit' ), 0,
allowAnonymous );
+ }
+
+ // Init all edit links (including lead section,
if anonymous editing is enabled)
+ $( '.edit-page' ).each( function () {
+ var $a = $( this ), section = 0;
+ if ( $( this ).data( 'section' ) !==
undefined ) {
+ section = $( this ).data(
'section' );
+ }
+ makeCta( $a, section, allowAnonymous );
+ } );
+ } else {
+ showSorryToast(
'mobile-frontend-editor-disabled' );
}
- makeCta( $a, section, allowAnonymous );
} );
}
--
To view, visit https://gerrit.wikimedia.org/r/169216
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia43fd0ddf35f2cfc26aecddf2bd3519f070c7494
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits