Page MenuHomePhabricator

Consolidate page protection transform
Closed, ResolvedPublic1 Estimated Story Points

Description

apps-android-wikipedia/www/js/main.js
wikipedia-ios/www/js/utilities.js
wikipedia-ios/www/less/misc.less
MobileApp/styles/editlinks.less

This transform is pretty simple and just modifies the root node's class list:

bridge.registerListener( "setPageProtected", function( payload ) {              
    var el = document.getElementsByTagName( "html" )[0];
    if (!el.classList.contains("page-protected") && payload.protect) {
        el.classList.add("page-protected");
    }
    else if (el.classList.contains("page-protected") && !payload.protect) {
        el.classList.remove("page-protected");
    }
    if (!el.classList.contains("no-editing") && payload.noedit) {
        el.classList.add("no-editing");
    }
    else if (el.classList.contains("no-editing") && !payload.noedit) {
        el.classList.remove("no-editing");
    }
} );