Page MenuHomePhabricator

Allow users to submit feedback via a QuickSurveys survey
Closed, ResolvedPublic5 Estimated Story Points

Assigned To
Authored By
phuedx
Dec 14 2021, 11:20 AM
Referenced Files
F35134358: quicksurvey_response.png
May 12 2022, 11:01 AM
F35134339: quicksurvey.png
May 12 2022, 11:01 AM
F35073316: image.png
May 3 2022, 4:38 PM
F35073175: image.png
Apr 29 2022, 11:39 AM
F34953932: image.png
Apr 25 2022, 4:39 PM
F35067109: image.png
Apr 25 2022, 1:44 PM
F35066961: Screenshot 2022-04-25 at 11.37.45.png
Apr 25 2022, 10:53 AM

Description

AC

  • The QuickSurveys form should show up next to the form on the results page on every successful submission

Design Spec

The survey should look like this:

image.png (1×1 px, 114 KB)

Notes

  1. Launching a survey is as simple as:
const SURVEY_NAME = '...';

mw.loader.using( 'ext.quicksurveys.init' )
   .then(
     () => mw.extQuickSurveys.showSurvey( SURVEY_NAME )
   );
  1. See T258419: Survey users about mediasearch on commons for detailed discussion about and implementation of launching a custom QuickSurveys survey

Related Objects

Event Timeline

phuedx updated the task description. (Show Details)
phuedx updated the task description. (Show Details)

@Prtksxna moving this to your column. We should prioritise this next.

Tchanders set the point value for this task to 8.Apr 19 2022, 4:19 PM

As @STran noted in T301940#7847239, QuickSurveys won't display on a non-article page (Special:SimilarUsers will be a non-article page).

There is a mechanism for customising which page a survey show on, introduced here, but only a page with a page ID can be specified (special pages have an ID of 0).

From the task description of T213696, it seems that there was an ask at some point to allow QuickSurveys to display on special pages, but it was decided against in discussions on that task.

@cwylo @Prtksxna, @Niharika and I discussed the possibility of adding a banner with a link to an external survey, instead of using QuickSurveys.

@phuedx - Just wanted to check that I'm not missing anything, before I file that?

From the task description of T213696, it seems that there was an ask at some point to allow QuickSurveys to display on special pages, but it was decided against in discussions on that task.

<snip />

@phuedx - Just wanted to check that I'm not missing anything, before I file that?

QuickSurveys targeting system doesn't work on pages outside of mainspace. It could be made to, but that's way out of scope for this task. However, QuickSurveys can be told to show a specific survey even when the user is browsing a special page.

For example, running the following in my browser's JavaScript console on https://ca.wikipedia.org/wiki/Special:Version:

// We use mw.loader.using here because the ext.quicksurveys.init module will
// not be loaded on special pages.
mw.loader.using( 'ext.quicksurveys.init' ).then( () => {
  mw.extQuickSurveys.showSurvey( 'perceived-performance-survey' );
} );

yields:

Screenshot 2022-04-25 at 11.37.45.png (1×2 px, 465 KB)

(I'd need to look into why the styles aren't loading)

I'll update the extension's documentation as there's no mention of the showSurvey() method.

Thanks @phuedx - I hadn't clocked that the example was meant as a workaround for the special page, since the discussion on T258419: Survey users about mediasearch on commons leads to them not displaying a survey on a special page.

(I'd need to look into why the styles aren't loading)

Adding the workaround locally with debugging on, I'm seeing warnings about failing to resolve custom WVUI components:

image.png (734×1 px, 268 KB)

I'll update the extension's documentation as there's no mention of the showSurvey() method.

See https://www.mediawiki.org/w/index.php?title=Extension:QuickSurveys&diff=prev&oldid=5182002

(I'd need to look into why the styles aren't loading)

Adding the workaround locally with debugging on, I'm seeing warnings about failing to resolve custom WVUI components:

image.png (734×1 px, 268 KB)

This was since fixed in T306819: Fix eslint config, use kebab-case for Vue component tags

Change 787792 had a related patch set uploaded (by Tchanders; author: Tchanders):

[mediawiki/extensions/SimilarEditors@master] Show feedback survey on successful form submission

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

Change 787796 had a related patch set uploaded (by Tchanders; author: Tchanders):

[integration/config@master] Add SimilarEditors dependency on QuickSurveys extension

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

Change 787796 merged by jenkins-bot:

[integration/config@master] Add SimilarEditors dependency on QuickSurveys extension

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

Mentioned in SAL (#wikimedia-releng) [2022-04-29T18:37:04Z] <James_F> Zuul: Add SimilarEditors dependency on QuickSurveys extension for T297687

Tchanders changed the point value for this task from 8 to 5.May 3 2022, 3:50 PM
// We use mw.loader.using here because the ext.quicksurveys.init module will
// not be loaded on special pages.
mw.loader.using( 'ext.quicksurveys.init' ).then( () => {
  mw.extQuickSurveys.showSurvey( 'perceived-performance-survey' );
} );

Note that showSurvey is called from the init script. This could show any enabled survey with an unrestricted (or compatible) audience, unless there is a URL param forcing it to show ours, in which case the snippet as-is seems to add the survey twice (easily remedied by removing the explicit showSurvey call). We could add this param via a hidden form field, but given that some users use special pages by building the URL from scratch, it's better not to rely on this for the survey to be shown.

@phuedx Not sure if the documentation needs updating in light of the above? I'm hesitant because the survey-adding behaviour depends on very particular combinations of config settings, so I may yet be missing something.

For reviewers: The patch adds the ext.quicksurveys.init module from the PHP, and the survey configuration ensures that the correct survey will be shown. See T307025 for more details, but briefly:

  • Setting $config['audience']['pageIds'] ensures we don't do audience checks on every page where QuickSurveys is loaded, and setting it to 0 ensures it passes this check on Special:SimilarEditors
  • Setting 'coverage' => 1 and 'embedElementId' => 'similareditors-survey-embed' ensures we never show another enabled survey (which would be possible if another survey had an unrestricted/compatible audience)

Note that showSurvey is called from the init script. This could show any enabled survey with an unrestricted (or compatible) audience <snip>

This is a bug. The client-side survey filtering should also reject surveys when the current page is outside of mainspace unless they're being shown using ::showSurvey().

</snip> ... unless there is a URL param forcing it to show ours, in which case the snippet as-is seems to add the survey twice (easily remedied by removing the explicit showSurvey call). We could add this param via a hidden form field, but given that some users use special pages by building the URL from scratch, it's better not to rely on this for the survey to be shown.

This too is a bug, which I had thought was already captured in a task but isn't.

I'll write both of these bugs up.

Thanks @phuedx!

(We will add the URL param anyway, since as @STran pointed out, we want to display the survey even to users who have submitted a response, and the URL param is the way to do this. We'll also keep the survey configured so that it should show up without the URL param when a user hasn't yet submitted a response.)

Change 787792 merged by jenkins-bot:

[mediawiki/extensions/SimilarEditors@master] Show feedback survey on successful form submission

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

Testing notes: This can be tested locally by adding the config from https://gerrit.wikimedia.org/r/c/mediawiki/extensions/SimilarEditors/+/787792 to LocalSettings.php

The survey should appear on Special:SimilarEditors every time a valid form is submitted, and never when the form is invalid.

dom_walden subscribed.

Here is how it looks on my local:

quicksurvey.png (346×1 px, 34 KB)

It only appears after you submit the Special:SimilarEditors form, or if you pass both the wpTarget and quicksurvey=similareditors parameters in the URL (e.g. http://localhost:8080/wiki/Special:SimilarEditors?wpTarget=Adam&quicksurvey=similareditors).

Here is what happens when you submit a response to the QuickSurveys survey:

quicksurvey_response.png (268×1 px, 32 KB)

If you then submit the Special:SimilarEditors form again the survey will reappear as in the first screenshot.

If you close the QuickSurveys survey it will disappear. But, if you submit the Special:SimilarEditors form again it will reappear.

(FYI I have documented how to install it locally here.)

Test environment: local docker Similar Editors 0.0.0 (2e0280d) 22:13, 9 May 2022. QuickSurveys 1.4.0 (d6d315f) 10:06, 7 May 2022.