Page MenuHomePhabricator

Banner and JS review request for 'stewvote' banner (desktop & mobile)
Closed, ResolvedPublic

Description

Requesting banner and in-banner JS review for the upcoming steward elections voting which will start on 8 February.

Banner JS has lately turned out to be problematic, specially on mobile devices. Requesting help into creating and/or fixing them.

Thank you.

Event Timeline

Ideally we can use the same banner for mobile and desktop if we remove the "more info" box to the right. I'll change 'stewvote' to use @Seddon's v2 version, but will leave the current JS as it is for you to review.

Noting here that this should be done before February 7 if possible.

MarcoAurelio raised the priority of this task from High to Unbreak Now!.Feb 4 2019, 7:15 PM

This is happening on 3 days and I'd rather not run into script issues that makes the banner go wild. Please help. Thank you.

This is happening on 3 days and I'd rather not run into script issues that makes the banner go wild. Please help. Thank you.

Hi @MarcoAurelio! Thanks so much for filing this task and for highlighting its urgency.

I took a peek at the banner. Quick question: Is the script taken from a banner for the same topic from a previous year? Modified at all since?

There are several things we can improve about the script:

  • Instead of cookies, it should use CentralNotice's built-in key-value store. This will allow easy use of LocalStorage. Cookies are a performance draw, since, unlike LocalStorage data, they are sent back and forth on every request. Also, note that the acceptability of content to be stored in cookies and LocalStorage use should always be reviewed, since there can be privacy issues. I imagine it's OK in this case, though. (Perhaps this aspect was already reviewed in a previous year?) The code for the key-value store is ext.centralNotice.kvStore.js; see ext.centralNotice.impressionDiet.js for examples.
  • As with the banner for nominations, it should provide an alterImpressionData callback so that we can get data on whether the banner was really displayed or not.
  • I don't know the reason for using the banner name, via {{{banner}}}, as the id of the element with the content to show or hide. I didn't try to change it in the nominations banner, but it is fragile. (In fact that's what broke the other banner on mobile.) Is there a reason not to just use a hardcoded string for the element id?
  • Though this task says there's no mobile banner, the banner linked is set to display on both desktop and mobile. As before, we do need to test it wherever (desktop or mobile) it will display.
  • Is there a hard deadline before which editors must accumulate the required number of edits to vote? What if they achieve the required number before the deadline, but after the CN campaign starts? I guess, in that case, they wouldn't see the banner, even if they're eligible, since their initial ineligibility would remain stored in a cookie or LocalStorage?

I hope this is useful! I think we can fix it in time... Thanks again!!!

Thanks @AndyRussG - The current voting elegibility rules are at https://meta.wikimedia.org/wiki/Stewards/Elections_2019/Guidelines#Voters : not be a bot, have made at least 600 edits globally (on all Wikimedia wikis) before 01 November 2018 and have made at least 50 edits globally (on all Wikimedia wikis) between 01 August 2018 and 31 January 2019.

The script in the banner is what we've been using from ages. Given that none of us seems to be fluent with JS coding we've been reusing the same script over the years, just modifying the var MIN_REGISTRATION variable.

I have unchecked the checkboxes for other devices not being desktop devices so this banner in its current state isn't shown on non-desktop devices.

I've refactored the javascript and created a test banner with it:

https://meta.wikimedia.org/wiki/Special:CentralNoticeBanners/Edit/stewvote_test_T214773

Please test on a bunch of different browsers and platforms.

Note also that to move this test content to another banner, you'll need to copy more than just the script--I also modified the id of the banner content DOM element. So, please copy the whole banner, rather than just the script (or adjust the attributes of that element as per the test banner).

Thanks!!!!

I have tested it displays correctly to me using https://meta.wikimedia.org/w/index.php?title=Special:Random&banner=stewvote_test_T214773&uselang=en&force=1

When I went to aa.wikibooks I guess it's not displaying to me because I got it displayed already at Meta?

I have copy/pasted the entire banner as you requested at https://meta.wikimedia.org?diff=18854827

Will keep checking, but thanks so much for the help.

When I went to aa.wikibooks I guess it's not displaying to me because I got it displayed already at Meta?

Was my language there not being set in Afar. Displays okay to me.

When I went to aa.wikibooks I guess it's not displaying to me because I got it displayed already at Meta?

Was my language there not being set in Afar. Displays okay to me.

Ah ok great! I wasn't able to get it there because I somehow couldn't log in there. I guess I could just set the test banner to be displayed to anons, only for there...

Will a version eventually be shown on mobile, too? (I noticed the name of the task mentions mobile...) Thanks!!!

Ah ok great! I wasn't able to get it there because I somehow couldn't log in there. I guess I could just set the test banner to be displayed to anons, only for there...

Given that aa.* wikis are closed you cannot create accounts there unless your account existed before the freezing of the project (IIRC).

Will a version eventually be shown on mobile, too? (I noticed the name of the task mentions mobile...) Thanks!!!

It'd be a good to have, yes. However if we're going to run into JavaScript issues then no. If we decide to run for mobile, it doesn't need to be an elaborate CSS design and https://meta.wikimedia.org/w/index.php?oldid=18857528 (as example of how it could look like; the code probably lacks support for mobile browsers, etc.) could suffice.

Ammarpad lowered the priority of this task from Unbreak Now! to Needs Triage.Mar 3 2019, 2:46 PM
Ammarpad subscribed.

Lower priority as this year's Stewards Election has been concluded.