Commit graph

574 commits

Author SHA1 Message Date
Sam Smith 41dc6d396a Conditionally enable Popups
Changes:
* Disable the desktop target by default
* If the user is in the experiment condition, then enable the desktop
  target
* Add PopupsExperiment config var, which, if set to true, causes: the
  experiment config to be added to the output as config vars, as well as
  the ext.popups.desktop Resource Loader module

Bug: T132604
Change-Id: Ia71ca924c3e2ec2ee0b0191ea2573fa7ff5e8a7e
2016-05-19 23:47:02 +00:00
Sam Smith c4667fd133 Convert isUserInCondition from async to sync
As there are an unmanageable amount of synchronous checks of
mw.popups.enabled, convert mw.popups.experiment.isUserInCondition to a
synchronous method.

Follow on I4959749.

Bug: T132604
Change-Id: Ide07e62868c77bfcd78af58dcec7303a35a72157
2016-05-19 14:06:17 -07:00
Sam Smith e9ddc8328d Handle user explicitly enabling/disabling feature
Follow on I4959749.

Bug: T132604
Change-Id: I4e6780f17b0423823295be9410a4343150e1e562
2016-05-19 19:10:53 +01:00
Translation updater bot 8f12b9d35f Localisation updates from https://translatewiki.net.
Change-Id: Ie824763264c136b7647f1397a822d670d54c5550
2016-05-18 22:13:27 +02:00
jenkins-bot 31430aefd8 Merge "Add ext.popups.experiment module" 2016-05-18 19:06:29 +00:00
Jdlrobson eff7dc95e6 Revert "Add properties that will be logged with each EL request"
Breaks EventLogging as the old schema is not compatible with these
new properties. We will reapply the patch later when in a better state.
My bad for merging.

This reverts commit ca20031a0e.

Change-Id: Ia961e0f99339f9045af9d0a4653599a48518cc95
2016-05-18 18:47:16 +00:00
Sam Smith 3f03d681c9 Add ext.popups.experiment module
Changes:
* Add the ext.popups.experiment module
* Add the mw.popups.experiment.isUserInCondition function, which
  returns a promise that resolves with true if the user is in the
  experimental condition, otherwise false
* If the experiment isn't configured, i.e. wgPopupsExperimentConfig is
  null or undefined, then the user isn't entered into the experiment,
  providing a kill switch

Bug: T132604
Change-Id: I49597494273e3862711a32e4951c8598e6c8bf59
2016-05-18 17:28:46 +01:00
jenkins-bot 85b27d8de8 Merge "Do not directly manipulate the cached object" 2016-05-18 09:28:41 +00:00
jenkins-bot 95d16e75de Merge "Add properties that will be logged with each EL request" 2016-05-17 21:42:53 +00:00
jdlrobson 69fff17141 Make SVG thumbnails show for Internet Explorer
IE9 does support SVG if you use  setAttributeNS.
Thus stop whitelisting SVG support there.

Don't worry about fallback rendering of SVG for IE < 9
- those that do not support SVG also do not
enjoy ResourceLoader JavaScript support.

Bug: T134979
Change-Id: I1d3d9c4c622e98df19a5e9dc4101b44242e07178
2016-05-17 20:27:09 +00:00
Baha ca20031a0e Add properties that will be logged with each EL request
Bug: T131315
Change-Id: I16f5f8170174200bb20c6bcc2835efd136d752ff
2016-05-16 16:39:07 -07:00
Baha cda1ffe425 Use mw.eventLog.Schema to log EventLogging events
This change is an intermediate step in our transition
to logging a variety of events easily.

Also:
  * Some events may need sendBeacon support and may not be
    logged if the navigator does not support sendBeacon.
  * Do not load schema code if EventLogging is not available.

Bug: T131315
Change-Id: Iff939577f65f1c6c71701dd6967939445385fb70
2016-05-16 17:29:48 -04:00
Translation updater bot 7c2323bb74 Localisation updates from https://translatewiki.net.
Change-Id: Ib7e9e28ac9bc1c0006e5b344ee9713b80f2d0cc4
2016-05-15 22:30:20 +02:00
Translation updater bot 53061366f8 Localisation updates from https://translatewiki.net.
Change-Id: I697040c4e5e26e4a669182bd0f5bfb5b82b9ef8c
2016-05-13 22:22:37 +02:00
jenkins-bot e09175aaa7 Merge "Describe init method behaviour via QUnit tests" 2016-05-13 18:35:44 +00:00
jenkins-bot 5f100a5de4 Merge "Rewrite createPopup with template for better readability" 2016-05-13 18:25:15 +00:00
Prateek Saxena 21b856f7f7 Use correct selector for div's that hold PNGs when SVGs aren't supported
* The classes in ext.popups.core.less apply to the thumbnail
which reside in .mwe-popups > div > a.popups-discreet
The thumbnail is thus not a direct child of the div parent of
popups-discreet.
* The margin-top is unnecessary.

Change-Id: If91140a55baa1aef36483002de681503c2690cf6
2016-05-13 18:12:11 +00:00
jdlrobson 7f3be6dcd4 Do not directly manipulate the cached object
Popups currently makes use of a render cache. Using a cache in this
way without protection causes problems (I will look at cleaning this up)

The hack below it
`mw.popups.$popup.html( mw.popups.$popup.html() );`
will lead to the html of the cached object being wiped out on IE9 meaning
future loads will show an empty popup.

Add a unit test (which previously would fail in IE9) to protect against this
in future.

Bug: T68496
Change-Id: Icef784fb389b0ab1856e2ba7464c9423ebcd62ab
2016-05-12 16:56:19 -07:00
jdlrobson ed3500b1bd Describe init method behaviour via QUnit tests
Change-Id: I78c4a4ac7b653e31ce52104cbdaef3d6390b2e20
2016-05-12 16:22:59 -07:00
jdlrobson 27d811a173 Rewrite createPopup with template for better readability
Change-Id: If646623ba4ebf5dfac2a94c73b6f053131739767
2016-05-12 16:19:13 -07:00
jdlrobson ab15bf8b3e Add tests for createPopup
Change-Id: I72381ec665427ee2c5c5631d9bc07a1ad5079646
2016-05-12 15:33:50 -07:00
Sam Smith 26be90dc5a Add client-side validation of PopupsSurveyLink
Changes:
* Extract survey link element creation into
  mw.popups.render.renderers.article#createSurveyLink
* Make #createSurveyLink throw an error if the URL doesn't start with
  https or http
* Add unit tests that cover the new behaviour of #createSurveyLink

Bug: T129177
Change-Id: I8b61cb0e94ab4e30bc894c279bb05918ecc7719e
2016-05-11 14:53:30 +01:00
Sam Smith dab4f55e0d Annotate survey link with rel=noreferrer
Don't leak referrer information or `window.opener` to the survey hosting
site.

Bug: T129177
Change-Id: I828bd01391bc1e034fe5655d89209b83f192b112
2016-05-11 14:02:55 +01:00
jdlrobson 0be6753836 Document PopupsSurveyLink with cautionary note
Bug: T129177
Change-Id: I67f6a5157a6f31a58fd57744f16130f7e92a7feb
2016-05-11 12:19:14 +00:00
jenkins-bot 9a9b4abdea Merge "Allow brackets in createImgThumbnail" 2016-05-11 10:16:07 +00:00
jdlrobson f3d23c975f Allow brackets in createImgThumbnail
Changes:
* Quote the URL with double quotes when generating the background-image
  rule

Bug: T129177
Change-Id: I74748c7efe67954272ce0a539455b0b00001a26a
2016-05-11 10:18:49 +01:00
Prateek Saxena 46f69baf38 article: Remove bracketed text from the title before looking to bold it in the extract
Bug: T69224
Change-Id: I5306101a7acd3c33c55989e97c7581a403594645
2016-05-10 21:51:57 +00:00
Prateek Saxena ed327f8ee6 Minor refactor
1. Add comment for empty SPAN when there is no thumbnail
2. Use footer instead of div.timestamp-* as it also contains
   the settings icon now.

Change-Id: Ia6fca32770596c980b33a9a6e58bb08b661b90d1
2016-05-10 14:23:08 -07:00
Translation updater bot f9a84529e9 Localisation updates from https://translatewiki.net.
Change-Id: I662a5a03e1526a24943e3f44ccc96729d708a430
2016-05-10 22:29:19 +02:00
jenkins-bot 10517dee21 Merge "Add QUnit test for ext.popups.settings" 2016-04-28 20:32:19 +00:00
Baha 72dd872781 Add QUnit test for ext.popups.settings
Test pieces that make sense, everything else is already
covered in cucumber tests. See the following commit for more
info: I55f311b6b8845e6ebf4cc5698758afd1f9042a45.

Bug: T133025
Change-Id: I474c1569494601ae5865dcfba22ea728220ff8df
2016-04-28 16:13:20 -04:00
jenkins-bot d9a4c8b0a3 Merge "QA: add a browser test to cover "enable previews" feature" 2016-04-28 08:40:51 +00:00
Baha 85cc7e2257 QA: add a browser test to cover "enable previews" feature
Test whether:
* "Enable previews" footer link correctly appears/disappears;
* A hovercard correctly shows/doesn't show when enabled/disabled.

Bug: T133054
Change-Id: I55f311b6b8845e6ebf4cc5698758afd1f9042a45
2016-04-27 20:22:34 +00:00
Sam Smith 91d3b510cb Add test to cover mw.popups.setupTriggers
Follow up Id173b21.

Bug: T133020
Change-Id: Id97cc7c7cb546d09c196dab8377e9e61a0b12f85
2016-04-27 19:20:27 +00:00
Translation updater bot 28af47b231 Localisation updates from https://translatewiki.net.
Change-Id: Ia2bb5e371825809efd66311d486a7c5a8bce27af
2016-04-26 22:30:46 +02:00
Sam Smith 5f69a721fc Add missing mw.popups.selectPopupElements test case
Follow up on Id173b21 by adding a test case that covers the test of
whether the anchor's title is in a content namespace.

Bug: T133020
Change-Id: I414a5ff8aa4edf58dd0d1947db077afdd1d22f39
2016-04-26 09:25:25 +01:00
jenkins-bot 9b7797dd6d Merge "Add QUnit tests to cover ext.popups.core.js" 2016-04-22 08:54:00 +00:00
jenkins-bot 57bc00c9ad Merge "QA: Updates to browser tests to avoid flakiness" 2016-04-20 22:39:39 +00:00
Baha 728073d9e4 QA: Updates to browser tests to avoid flakiness
* Wait until the form submits successfully, verifying it
worked by testing for the notification toast.
* Drop sleep statements where possible - instead use when_present
Use one when asserting something doesn't show to avoid false positives
* Allow more time for the hovercard to show (5s) - API requests might take
longer than default time.
* Assert popups JavaScript loads before continuing with test. This
helped trap a bug in testing and will be useful for future.

Bug: T133019
Depends-On: Icb1e6ddc8f95da5e4b4de2916d292694c11ba731
Change-Id: Iacd3beedf44cadffcf0285231b2df7e5b64294f6
2016-04-20 20:02:13 +00:00
Baha 06b49dc6b8 Add QUnit tests for ext.popups.logger
Bug: T133024
Depends-On: Icb1e6ddc8f95da5e4b4de2916d292694c11ba731
Change-Id: I73fee2e3351de357f8f60bf6287a876e245117df
2016-04-20 18:33:53 +00:00
Baha b1ec40a202 Add QUnit tests to cover ext.popups.core.js
Bug: T133020
Depends-On: Icb1e6ddc8f95da5e4b4de2916d292694c11ba731
Change-Id: Id173b215701abb87f998722526d643f36f3c0308
2016-04-20 18:33:50 +00:00
Sam Smith 6a0e108384 QA: Enable Hovercards beta feature in browser tests
Bug: T133019
Change-Id: I63faec86a756f189a40d0f61c75e33060c5395fb
2016-04-20 18:20:27 +00:00
Phuedx def7e41192 Merge "Add browser test for hovering link" 2016-04-19 13:28:04 +00:00
Baha 3e78503e8e Add browser test for hovering link
Basic feature of browsing a page, hovering a link, and showing/hiding
a hovercard.

Depends-On: Ie94fa399512be041f12b2f7cada20d4206ddaf82
Bug: T133019
Change-Id: Idf39e7e2a3b343babd6d0538225b4ef9002e8ac1
2016-04-19 13:12:24 +00:00
jenkins-bot 9f83c10ad8 Merge "Bold only first instance of title in extract" 2016-04-18 10:14:19 +00:00
Baha 8f3832e68a Add X-Analytics request header when fetching popup data
API requests to fetch the hovercards data now include
`X-Analytics: preview=1` header so that HoverCard hovers are
easily distinguishable in Hive.

Bug: T129425
Change-Id: I69df51a627951c4373b3b7463ab5b2c0a129faa1
2016-04-13 14:32:00 -04:00
Prateek Saxena 5f92196541 Bold only first instance of title in extract
Bug: T132523
Change-Id: I3145186264edd23ca898365ae55184cbe96ada6a
2016-04-13 21:24:42 +05:30
Translation updater bot e53a093c73 Localisation updates from https://translatewiki.net.
Change-Id: Ib4a0ae699c368d3239f14fb23c2cf6e087c3b45f
2016-04-10 20:06:43 +02:00
Translation updater bot acd15bcae2 Localisation updates from https://translatewiki.net.
Change-Id: If47645a451cc113b0d7a392958bfccb64f9aa5f9
2016-03-28 22:44:50 +02:00
Translation updater bot fd85826ec5 Localisation updates from https://translatewiki.net.
Change-Id: Ic5e19931eefab8d5a5048d054627a5bf92495227
2016-03-27 21:22:00 +02:00