Page MenuHomePhabricator

TypeError: this.setFlags is not a function preventing datetime fields from being loaded
Closed, ResolvedPublic

Description

While testing some new AbuseFilter features on Beta Cluster, I noticed that something in OOUI 0.31 is causing the error in the title. Specifically, if you head to https://deployment.wikimedia.beta.wmflabs.org/wiki/Special:AbuseFilter/test, you'll see that the form is missing a field ("Changes made after:") and the following ("Changes made before:") isn't fully initialized. Both of these are datetime fields, and this is what's logged in the console:

TypeError: this.setFlags is not a function
    at MwWidgetsDatetimeDateTimeInputWidget.mw.widgets.datetime.DateTimeInputWidget.updateFieldsFromValue (<anonymous>:135:308)
    at MwWidgetsDatetimeDateTimeInputWidget.mw.widgets.datetime.DateTimeInputWidget.setupFields (<anonymous>:134:738)
    at new MwWidgetsDatetimeDateTimeInputWidget (<anonymous>:129:479)
    at Object.OO.ui.Element.static.unsafeInfuse (load.php?debug=false&lang=en&modules=jquery%2Coojs-ui-core%2Coojs-ui-widgets|oojs-ui.styles.icons-editing-advanced&skin=vector&version=0gwg1ug:160)
    at deserialize (load.php?debug=false&lang=en&modules=jquery%2Coojs-ui-core%2Coojs-ui-widgets|oojs-ui.styles.icons-editing-advanced&skin=vector&version=0gwg1ug:160)
    at Object.oo.copy (<anonymous>:76:635)
    at Object.oo.copy (<anonymous>:77:162)
    at Object.OO.ui.Element.static.unsafeInfuse (load.php?debug=false&lang=en&modules=jquery%2Coojs-ui-core%2Coojs-ui-widgets|oojs-ui.styles.icons-editing-advanced&skin=vector&version=0gwg1ug:160)
    at Object.OO.ui.Element.static.infuse (load.php?debug=false&lang=en&modules=jquery%2Coojs-ui-core%2Coojs-ui-widgets|oojs-ui.styles.icons-editing-advanced&skin=vector&version=0gwg1ug:158)
    at Object.OO.ui.infuse (load.php?debug=false&lang=en&modules=jquery%2Coojs-ui-core%2Coojs-ui-widgets|oojs-ui.styles.icons-editing-advanced&skin=vector&version=0gwg1ug:154)

I tested this on my local wiki with core+OOUI ~2 weeks old and it didn't happen, so I guessed that this comes from OOUI 0.31.

Event Timeline

Daimona created this task.Mar 17 2019, 3:01 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 17 2019, 3:01 PM
Daimona triaged this task as High priority.

Train blocker because this hides form fields, high prio because there's time to fix it before the train starts.

Daimona renamed this task from TypeError: this.setFlags is not a function preventing fields from being loaded to TypeError: this.setFlags is not a function preventing datetime fields from being loaded.Mar 17 2019, 3:02 PM
zeljkofilipin raised the priority of this task from High to Unbreak Now!.Mar 18 2019, 9:31 AM
zeljkofilipin added a subscriber: zeljkofilipin.

Train blockers are Unbreak Now!.

Restricted Application added subscribers: Liuxinyu970226, TerraCodes. · View Herald TranscriptMar 18 2019, 9:31 AM

Train blockers are Unbreak Now!.

I chose high because there was some time to fix it before train, but actually yes, this should be UBN. Of note, I confirm that this really happens for every datetime field, for instance on Special:Block.

It was high last week, it's UBN! this week. 😄

A quick look points at https://gerrit.wikimedia.org/r/#/c/oojs/ui/+/495296/, since setFlags is a method defined in the FlaggedElement class.

EDIT (after writing the above): yep, coming with a fix.

Change 497260 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/core@master] Mixin FlaggedElement to DateTimeInputWidget

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

Daimona claimed this task.Mar 18 2019, 10:10 AM

@Daimona 497260 should fix the problem?

@zeljkofilipin Yes, it does. And I can also confirm that DateTime is the only input type affected by this bug.

Thanks. I've left a comment in Gerrit that that patch is related to train blocker. It should speed up the review.

Change 497260 merged by jenkins-bot:
[mediawiki/core@master] Mixin FlaggedElement to DateTimeInputWidget

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

Jdforrester-WMF closed this task as Resolved.Mar 18 2019, 10:05 PM
Jdforrester-WMF removed a project: Patch-For-Review.
Jdforrester-WMF added a subscriber: Jdforrester-WMF.

Fixed in master. No back-port needed.

Belated thanks @Daimona! :)