Page MenuHomePhabricator

Opening mentorship module on mobile throws JS error if it lists a question that's more than 30 days old
Closed, ResolvedPublic

Description

This happens because the code added for T225941 in this change expects mobile.time.getTimeAgoDelta() to return a unit that is either days, weeks or years, but what it actually returns is days, months or years. For questions older than a week, that means there's an FOUC as the server-generated timestamp (in weeks) is changed to a timestamp in days (e.g. "2 weeks ago" -> "16 days ago"), which is bad but not terrible. For questions older than a month, it ends up passing undefined as the message key to mw.message, which crashes with a JS error.

Stack trace:

jquery.js?6fb03:3819 jQuery.Deferred exception: Cannot read property 'replace' of undefined TypeError: Cannot read property 'replace' of undefined
    at Object.escape (http://localhost:8080/w/resources/src/mediawiki.base/mediawiki.base.js?8818e:537:14)
    at Message.toString (http://localhost:8080/w/resources/src/mediawiki.base/mediawiki.base.js?8818e:149:26)
    at Message.text (http://localhost:8080/w/resources/src/mediawiki.base/mediawiki.base.js?8818e:204:16)
    at HTMLSpanElement.<anonymous> (http://localhost:8080/w/load.php?debug=true&lang=en&modules=ext.growthExperiments.Help%7Cext.growthExperiments.Homepage.Help%2CImpact%2CMentorship%2CQuestionPoster%2CRecentQuestions%7Coojs-ui-widgets%7Coojs-ui-widgets.icons&skin=minerva&version=00l6dv1:1456:8)
    at Function.each (http://localhost:8080/w/resources/lib/jquery/jquery.js?6fb03:355:19)
    at jQuery.fn.init.each (http://localhost:8080/w/resources/lib/jquery/jquery.js?6fb03:189:17)
    at http://localhost:8080/w/load.php?debug=true&lang=en&modules=ext.growthExperiments.Help%7Cext.growthExperiments.Homepage.Help%2CImpact%2CMentorship%2CQuestionPoster%2CRecentQuestions%7Coojs-ui-widgets%7Coojs-ui-widgets.icons&skin=minerva&version=00l6dv1:1431:30
    at fire (http://localhost:8080/w/resources/lib/jquery/jquery.js?6fb03:3269:31)
    at Object.fireWith (http://localhost:8080/w/resources/lib/jquery/jquery.js?6fb03:3399:7)
    at Object.fire (http://localhost:8080/w/resources/src/mediawiki.base/mediawiki.base.js?8818e:486:27)
    at MobileOverlay.<anonymous> (http://localhost:8080/w/load.php?debug=true&lang=en&modules=ext.centralauth.centralautologin.clearcookie%7Cext.eventLogging%7Cext.eventLogging.debug%7Cext.growthExperiments.HelpPanel.init%7Cext.growthExperiments.Homepage.Logger%2CLogging%2CMobile%7Cext.visualEditor.targetLoader%2Ctrack%2Cve%7Cjquery%2Coojs%2Coojs-router%2Coojs-ui-core%7Cjquery.accessKeyLabel%2Cclient%2Ccookie%2CtextSelection%2Cthrottle-debounce%7Cmediawiki.RegExp%2CString%2CTitle%2CUri%2Capi%2Cbase%2Ccldr%2Cexperiments%2CjqueryMsg%2Clanguage%2Cnotify%2Crouter%2Cstorage%2Ctemplate%2Cuser%2Cutil%2Cviewport%7Cmediawiki.libs.pluralruleparser%7Cmediawiki.page.startup%7Cmediawiki.template.mustache%2Cregexp%7Cmediawiki.ui.anchor%7Cmobile.init%2Csite%2Cstartup%7Cmobile.init.icons%7Cmobile.pagelist.styles%7Cmobile.pagesummary.styles%7Cmobile.site.styles%7Cmobile.startup.images%7Cmobile.startup.images.variants%7Cskins.minerva.icons.images.scripts%7Cskins.minerva.icons.images.scripts.misc%7Cskins.minerva.icons.page.issues.default.color%7Cskins.minerva.icons.page.issues.medium.color%7Cskins.minerva.icons.page.issues.uncolored%7Cskins.minerva.mainMenu.styles%7Cskins.minerva.options%2Cscripts%2Ctalk%2Ctoggling%7Cskins.minerva.options.share.icon%7Cuser.defaults&skin=minerva&version=19p4wr0:1040:68)
    at mightThrow (http://localhost:8080/w/resources/lib/jquery/jquery.js?6fb03:3535:29)
    at process (http://localhost:8080/w/resources/lib/jquery/jquery.js?6fb03:3603:12) undefined

Event Timeline

Change 533620 had a related patch set uploaded (by Catrope; owner: Catrope):
[mediawiki/extensions/GrowthExperiments@master] Revert "Update posted on timestamp when overlay is opened"

https://gerrit.wikimedia.org/r/533620

kostajh subscribed.

Moving to current sprint, since we've reverted the (resolved) task in T225941

Change 533620 merged by jenkins-bot:
[mediawiki/extensions/GrowthExperiments@master] Revert "Update posted on timestamp when overlay is opened"

https://gerrit.wikimedia.org/r/533620

kostajh claimed this task.

I guess we can close this and work on the re-opened T225941.

Yes, sorry for causing confusion by reopening that bug without closing this one.