Disable "page issues" feature when DiscussionTools is handling talk page

Bug: T312309
Change-Id: I9c3035c9dbe7545a05efb2286dffe0145d3557b4
This commit is contained in:
Ed Sanders 2022-10-11 13:50:38 +01:00
parent c5976996d9
commit f876accf9a
2 changed files with 24 additions and 14 deletions

View file

@ -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

View file

@ -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
};