Problem: The code to display a QuickSurvey in mobile is error prone. We are likely dropping a small but unknown percentage of survey views due to this problem.
QuickSurveys subscribes to a 'mobile.betaoptin' event to decide whether to show a survey in the mobile Minerva skin.
The problem with this is two-fold:
1) 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.
2) Race conditions: If the code for QuickSurveys loads AFTER MobileFrontend, the hook will be registered too late and the survey will never show. Right now we are relying on alphabetical order (the ResourceLoader module name ext.quicksurveys.init is before mobile.init in the alphabet). The code can load late for numerous reasons, particularly at the start of a survey for regular users of the site as the mobile.init module will likely be in cache and the QuickSurveys module will not.
= Proposed solution
[] QuickSurveys when running in mobile (wgMFMode is defined) should use mw.loader.using( 'mobile.init' ) before trying to run a survey.
[] 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 = []
```