Sometimes a question is primarily relevant to either logged-in or logged-out users. It should be easy to specify whether a question should be asked of logged-in or logged-out users, so that we don't waste editors' time (or readers' time) by collecting results that we won't really use.
Related to this, we should probably consider what the appropriate default setting is.
Acceptance criteria
- In a survey, it's possible to target only logged in users
- In a survey, it's possible to target only anonymous users
- Survey answers should log whether the user was anonymous or logged in
- If anons is set to true in the audience definition only anonymous user should see the survey
- If anons is set to false, only logged in users see the survey
- IF anons is omitted then the survey is shown to both anons and logged in users
- If I set anons to true but also define minEdits and maxEdits, then it is impossible for anyone to see the survey as someone cannot be anonymous AND have an edit count.
Developer notes
This will build on the framework setup in https://gerrit.wikimedia.org/r/493130
Given the work in T139317 we could expand audience to accept a property like so:
"audience" => [ 'anons' => true ]
Add 3 tests:
- anons = true (show only to anon )
- anons = false (show only to logged in)
- anons is undefined (show to both anons and logged in)
QA steps
Test on reading web staging DESKTOP.
- Open incognito window https://reading-web-staging.wmflabs.org/wiki/Test_the_diff
- Verify the survey shows in an incognito window
- Login
- Verify the survey doesn't show
QA Results
Status | Details |
✅ Passed | T186737#5039149 |