Problem: The code to display a QuickSurvey in mobile is error prone. We have potential for dropping a small but unknown percentage of survey views due to this problem.
Background
QuickSurveys subscribes to a 'mobile.betaoptin' event to decide whether to show a survey in the mobile Minerva skin.
This event only fires inside MobileFrontend if displayBetaOptIn is called inside the mobile.init module which only happens if mw.config.get( 'wgMFExperiments' ).betaoptin is . (luckily this is true on production) and if the user hasn't dismissed a request to opt-into beta (luckily given the experiment is disabled this won't happen in production.
Proposed solution
- QuickSurveys when running in mobile (wgMFMode is defined) should use mw.loader.using( 'mobile.init' ) before trying to run a survey. This will cause beta opt in panel to load if enabled
- QuickSurveys should check the presence of a .panel element inside .mw-parser-output to decide whether it shows or not, rather than using the existing mobile.betaoptin track event.
- mobile.betaoptin tracking event should be removed from MobileFrontend.
QA steps
- When the beta optin panel is enabled and displayed, no QuickSurveys show
- When I say "no thanks" to the beta opt in, the QuickSurveys shows
- Ask a developer to disable the beta opt in panel on mobile and check the QuickSurvey shows for all page views.
Developer notes
With MobileFrotend and QuickSurveys installed, a survey will never show (in the current setup, despite the fact it should) with the following config:
$wgExperiments = []