From fdcfcf284947eab43e0a91cebdf6027bc7108ef5 Mon Sep 17 00:00:00 2001 From: Nicholas Ray Date: Tue, 14 Jan 2020 11:49:58 -0700 Subject: [PATCH] Remove amc outreach from talk page As discussed in stand up we no longer need this feature on this page. Bug: T242491 Change-Id: I2f3e4b4028593c908f0e01055d6fd772734581f8 --- resources/skins.minerva.scripts/talk.js | 64 ++----------------------- 1 file changed, 5 insertions(+), 59 deletions(-) diff --git a/resources/skins.minerva.scripts/talk.js b/resources/skins.minerva.scripts/talk.js index aca028e62..92e0a8850 100644 --- a/resources/skins.minerva.scripts/talk.js +++ b/resources/skins.minerva.scripts/talk.js @@ -1,5 +1,3 @@ -var drawers = require( './drawers.js' ); - /** * @param {Object} mobile mobileFrontend component library */ @@ -160,62 +158,6 @@ module.exports = function ( mobile ) { .appendTo( '#content' ); } - /** - * @param {JQuery.Event} ev - * @param {Function} onDismiss - * @param {Function} onFollowRoute - * @param {string} returnToQuery - * @return {undefined} - */ - function showDrawerIfEligible( ev, onDismiss, onFollowRoute, returnToQuery ) { - var - amcOutreach = mobile.amcOutreach, - amcCampaign = amcOutreach.loadCampaign(), - drawer = amcCampaign.showIfEligible( - amcOutreach.ACTIONS.onTalkLink, - onDismiss, - talkTitle, - returnToQuery - ); - - // avoiding navigating to original URL - ev.preventDefault(); - - if ( drawer ) { - // stopPropagation is needed to prevent drawer from immediately closing - // when shown (drawers.js adds a click event to window when drawer is - // shown - ev.stopPropagation(); - - drawers.displayDrawer( drawer, {} ); - drawers.lockScroll(); - - return; - } - - onFollowRoute(); - } - - /** - * Called when user clicks on the add dicussion button located on a talk - * page - * - * @param {JQuery.Event} ev - */ - function amcAddTalkClickHandler( ev ) { - var - onFollowRoute = function () { - window.location.hash = '#/talk/new'; - }, - onDismiss = function () { - onFollowRoute(); - - toast.show( mw.message( 'mobile-frontend-amc-outreach-dismissed-message' ).text() ); - }; - - showDrawerIfEligible( ev, onDismiss, onFollowRoute, '#/talk/new' ); - } - /** * @return {boolean} */ @@ -234,7 +176,11 @@ module.exports = function ( mobile ) { // eslint-disable-next-line no-jquery/no-global-selector $addTalk = $( '.minerva-talk-add-button' ); - $addTalk.on( 'click', amcAddTalkClickHandler ); + $addTalk.on( 'click', function ( ev ) { + // avoid navigating to original URL in anchor element + ev.preventDefault(); + window.location.hash = '#/talk/new'; + } ); // We only want the talk section add overlay to show when the user is on the // view action (default action) of the talk page and not when the user is on