From f876accf9a08b406f2d2afb79c16b9876db718ae Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Tue, 11 Oct 2022 13:50:38 +0100 Subject: [PATCH] Disable "page issues" feature when DiscussionTools is handling talk page Bug: T312309 Change-Id: I9c3035c9dbe7545a05efb2286dffe0145d3557b4 --- resources/skins.minerva.scripts/initMobile.js | 8 +++-- resources/skins.minerva.scripts/talk.js | 30 +++++++++++-------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/resources/skins.minerva.scripts/initMobile.js b/resources/skins.minerva.scripts/initMobile.js index 3752a76e0..8cec06d00 100644 --- a/resources/skins.minerva.scripts/initMobile.js +++ b/resources/skins.minerva.scripts/initMobile.js @@ -24,6 +24,7 @@ module.exports = function () { references = require( './references.js' ), TitleUtil = require( './TitleUtil.js' ), issues = require( './page-issues/index.js' ), + talk = require( './talk.js' ), Toolbar = require( './Toolbar.js' ), ToggleList = require( '../../includes/Skins/ToggleList/ToggleList.js' ), TabScroll = require( './TabScroll.js' ), @@ -404,7 +405,10 @@ module.exports = function () { TabScroll.initTabsScrollPosition(); // Setup the issues banner on the page // Pages which dont exist (id 0) cannot have issues - if ( !currentPage.isMissing ) { + if ( + !currentPage.isMissing && + ( !currentPage.titleObj.isTalkPage() || talk.isSimplifiedViewEnabled() ) + ) { issues.init( overlayManager, currentPageHTMLParser ); } @@ -429,7 +433,7 @@ module.exports = function () { // wire up talk icon if necessary if ( permissions.talk ) { - require( './talk.js' )( mobile ); + talk.init( mobile ); } // wire up watch icon if necessary diff --git a/resources/skins.minerva.scripts/talk.js b/resources/skins.minerva.scripts/talk.js index 53e25e5d5..0c246c85f 100644 --- a/resources/skins.minerva.scripts/talk.js +++ b/resources/skins.minerva.scripts/talk.js @@ -1,9 +1,18 @@ +var SKIN_MINERVA_TALK_SIMPLIFIED_CLASS = 'skin-minerva--talk-simplified'; + +/** + * @return {boolean} + */ +function isSimplifiedViewEnabled() { + // eslint-disable-next-line no-jquery/no-class-state + return $( document.body ).hasClass( SKIN_MINERVA_TALK_SIMPLIFIED_CLASS ); +} + /** * @param {Object} mobile mobileFrontend component library */ -module.exports = function ( mobile ) { +function init( mobile ) { var - SKIN_MINERVA_TALK_SIMPLIFIED_CLASS = 'skin-minerva--talk-simplified', toast = mobile.toast, currentPage = mobile.currentPage(), api = new mw.Api(), @@ -168,20 +177,12 @@ module.exports = function ( mobile ) { .appendTo( '#content' ); } - /** - * @return {boolean} - */ - function isSimplifiedViewEnabled() { - // eslint-disable-next-line no-jquery/no-class-state - return $( document.body ).hasClass( SKIN_MINERVA_TALK_SIMPLIFIED_CLASS ); - } - /** * Sets up necessary event handlers related to the talk page and talk buttons. * Also renders the "Read as wikipage" button for the simplified mode * (T230695). */ - function init() { + function doInit() { var promise, // eslint-disable-next-line no-jquery/no-global-selector $addTalk = $( '.minerva-talk-add-button' ); @@ -211,6 +212,11 @@ module.exports = function ( mobile ) { } if ( talkTitle ) { - init(); + doInit(); } +} + +module.exports = { + init: init, + isSimplifiedViewEnabled: isSimplifiedViewEnabled };