Commit graph

1168 commits

Author SHA1 Message Date
Ed Sanders adf34dca4d build: Re-use MessageDirs in banana conf
Change-Id: Ia673030da7ce5f9114772cc879a0449743ef151a
2017-01-23 14:02:14 +00:00
jenkins-bot 5071efcf9c Merge "Inform users about conflicting gadgets/customizations" into mpga 2017-01-17 19:53:47 +00:00
Piotr Miazga 05060a3073 Inform users about conflicting gadgets/customizations
Changes:
 - Added a default help copy under Page Previews enable switch

Bug: T151058
Change-Id: I4f24906147e1e9d8a8f132a9a84606153c8694d7
2017-01-17 20:49:34 +01:00
Sam Smith 51c6f2c8e5 Hygiene: Make settings reducer control footer link
Since the footer link part of the settings system - clicking the link
opens the settings modal - it seems appropriate that it should be
controlled by state managed by the settings reducer.

Bug: T146889
Change-Id: I3a8549dbf1952cd0556f663496c55de91acaf2c0
2017-01-17 06:40:36 -08:00
Sam Smith c51b33c8b7 Send blob to everyone
As before, we need to send the Page Previews blob that logged out users
can enable/disable previews.

Changes:
* Unconditionally add the ext.popups RL module to the output.
* Send the value of Popups\PopupsContext#isEnabledByUser to the client
  as $wgPopupsIsEnabledByUser.
* Make mw.popups#isEnabled return $wgPopupsIsEnabledByUser if the user
  is logged in.

Bug: T146889
Change-Id: Id2ccfaa81a327e222fff400f4a5f22f96c99ea31
2017-01-17 06:40:24 -08:00
Sam Smith c6a502954d Vary cog click behavior
The behavior of the cog varies when:

* The user is logged in/out.
* Page Previews is enabled as a beta feature.

Since the behavior of the cog doesn't vary per-preview, it can be
determined at boot time and passed to the renderer. However, in order to
keep the renderer stateless, we pass the behavior to it when a preview
is added to the DOM.

Changes:
* Add the mw.popups.createPreviewBehavior factory function, which
  returns an object that encapsulates how a preview responds to the user
  dwelling on it, abandoning it, and clicking on the cog.
* Invoke mw.popups.createPreviewBehavior at boot time and pass it to the
  mw.popups.changeListeners.render change listener, which then passes it
  to mw.popups.Preview#show.
* Make mw.popups.Preview#show responsible for binding event handlers
  and configuring the cog based on the behavior.

Bug: T146889
Change-Id: I39d7d0afd7b1fe896019a1b3a82ee907bfb20edd
2017-01-15 16:20:22 -08:00
jenkins-bot cc35a016b3 Merge "Forward PopupsBetaFeature to the client" into mpga 2017-01-15 23:54:21 +00:00
jenkins-bot 1b7283a301 Merge "Hygiene: Rename SchemaPopupsSamplingRate" into mpga 2017-01-15 23:38:53 +00:00
jenkins-bot e1b71f5d3f Merge "actions: Merge LINK_ABANDON_* + PREVIEW_ABANDON_*" into mpga 2017-01-15 23:28:23 +00:00
jenkins-bot 5020424fbb Merge "Hygiene: Remove link element from LINK_ABANDON_*" into mpga 2017-01-15 23:24:18 +00:00
jenkins-bot 9a5cd90ba8 Merge "Hygiene: Remove unused action types" into mpga 2017-01-15 23:23:19 +00:00
Sam Smith dfccc55bb5 Forward PopupsBetaFeature to the client
Bug: T146889
Change-Id: I66739b01e405bd7be29e912388005e0bb1f25b3f
2017-01-15 11:04:44 -08:00
Sam Smith 98b2dcf631 Hygiene: Rename SchemaPopupsSamplingRate
The SchemaPopupsSamplingRate config variable is inconsistently named and
even forwarded to the client as wgPopupsSchemaPopupsSamplingRate.

Changes:
* SchemaPopupsSamplingRate -> PopupsSchemaSamplingRate
* Forward PopupsSchemaSamplingRate to the client as
  $wgPopupsSchemaSamplingRate.

Bug: T146889
Bug: T146434
Change-Id: I80d6a0abccf462e2eb0fd96af6849b5e82b49c26
2017-01-15 11:01:00 -08:00
Sam Smith 787660f956 actions: Merge LINK_ABANDON_* + PREVIEW_ABANDON_*
Per Id1339dc2, the LINK_ABANDON_* and PREVIEW_ABANDON_* actions can (and
should) be merged, as they are always reduced in the same way.

Change-Id: I71b30d4d2774deb4efea9e565f2ccd7383bf08c1
2017-01-15 09:55:36 -08:00
Piotr Miazga c13ab30bfa Move conflicting NavPopups gadget name into config var
Changes:
 - removed hardcoded comflicting Navigation Popups gadget name
 - introduced a config variable to specify conflicting gadget name

Bug: T151058
Change-Id: Ief5c6f90ec6dd6c074931f7d9ff20297d4718fe5
2017-01-12 18:07:20 +01:00
Sam Smith 49ce7643f0 Hygiene: Remove link element from LINK_ABANDON_*
Initially, the link element was added to LINK_ABANDON_* to determine
when an interaction should be reset. However, this wasn't enough to
protect against timing-related bugs, e.g. T154923. Now that tokens are
used to determine when interactions should be reset, the link element
can safely be removed from the LINK_ABANON_* actions.

Supporting changes:
* Update the return type of mw.popups.actions.linkAbandon in its
  DocBlock.

Change-Id: Iaaed7a4846af75f9c4051d7bc761022ea5b3f6cf
2017-01-11 14:33:46 -08:00
Sam Smith 1e2fd94734 Hygiene: Remove unused action types
PREVIEW_ANIMATING and PREVIEW_INTERACTIVE were introduced in
Ib495755b but never used.

Change-Id: Ib849960874f938185414ae74bc67d906f26aae0c
2017-01-11 12:56:32 -08:00
jenkins-bot 4d0f0a489a Merge "Disable Page Previews preferences when NavPopups are enabled" into mpga 2017-01-11 15:39:36 +00:00
jenkins-bot a57a0a321d Merge "Fix linkTitleChangeListener" into mpga 2017-01-11 04:27:30 +00:00
Sam Smith e17e209003 Fix linkTitleChangeListener
I2ecf575b introduced a regression where the linkTitleChangeListener
wouldn't destroy the active link's title if it had been dwelled on
within 300 ms of the previous active link being abandoned.

The LINK_ABANDON_END action is dispatched after 300 ms and ignored if
the active link has changed.

Change-Id: If0c16afd6ca1c44f0e7eed497f62f0190005a619
2017-01-10 18:03:47 -08:00
joakin 21230742c0 Change preview to check *_ABANDON_END with tokens
... instead of using the active elements, and check also the user
dwelling flag to only act if the user is not dwelling.

Preview and link abandon end and start share now test cases, meaning it
can be collapsed into one action creator in a followup commit.

Change-Id: Id1339dc23e8f1b1b7514c769cd09f8bdadc759b4
2017-01-10 17:52:53 -08:00
joakin e49103061e Don't reset interaction info when dwelling back to a link
When dwelling back to a link, previously a new LINK_DWELL action would
be sent and the reducer would reset the interaction as if it was a new
one.

This shouldn't happen, since dwelling back to the active link (from
the preview, for example) is not a new interaction, and should not
create a new interaction or hide and show the preview.

With this change, the preview reducer has the notion of new or repeat
interactions, and only resets state on new ones, and only sets
isUserDwelling when dwelling on a the link of the current interaction.

Also when the interaction is repeat, we guard on the action creator and
don't trigger the wait or the fetch request.

Change-Id: I71cde81cbfe50b6f955e562e7e5b57d0f920fdb9
2017-01-10 17:44:37 -08:00
joakin 36518b1215 Don't hide preview when user dwells on link
... after dwelling on preview.

Currently, the asynchronous PREVIEW_ABANDON_END action wouldn't be
ignored if the user were to have dwelled on the link that the preview is
about. The action is only ignored if the user is dwelling on the
preview, i.e. if preview.isUserDwelling is truthy.

Set preview.isUserDwelling to truthy if the user is dwelling either on
the link or on the preview.

Bug: T154923
Change-Id: I8e6989790da5884992ee9dda9e4895e2e58e6694
2017-01-10 17:43:55 -08:00
Sam Smith af05386ea4 actions: Add token to PREVIEW_ABANDON_**
Change-Id: Ic84aa0c3144761b93beff9b7b82932647e504a5b
2017-01-10 16:47:19 -08:00
Sam Smith 489f1e69f2 Run previewAbandon action creator tests
Unfortunately, QUnit doesn't complain that QUnit#module was being called
with a function and not an object.

Change-Id: I6d3b4941566fa4e4ecad2dbe6f7b5fdd62cdaf72
2017-01-10 16:47:11 -08:00
Piotr Miazga 211f1d1658 Disable Page Previews preferences when NavPopups are enabled
Changes:
 - introduced PopupsGadgetsIntegration class handles all checks
 - show help message on Preferences page when NavPopups is enabled
 - unit test everything

Bug: T151058
Change-Id: Ia474b1b30378efe84dedf3ad47c1f833e88d69b5
2017-01-11 01:06:48 +01:00
jenkins-bot 064437d7f7 Merge "actions: Conditionally dispatch LINK_DWELL" into mpga 2017-01-10 19:52:42 +00:00
jenkins-bot f3618e78bd Merge "actions: Add token to LINK_ABANDON_*" into mpga 2017-01-10 19:38:11 +00:00
jenkins-bot 66d325cad7 Merge "reducers: Store interaction tokens" into mpga 2017-01-10 19:37:28 +00:00
jenkins-bot 5ad4edf53d Merge "Hygiene: interactionToken -> token" into mpga 2017-01-10 19:34:52 +00:00
jenkins-bot fc2b055934 Merge "Hygiene: use UserGetDefaultOptions instead of ExtensionRegistration" into mpga 2017-01-10 18:53:45 +00:00
Sam Smith df0f175d72 actions: Conditionally dispatch LINK_DWELL
Change-Id: I9046296f061677674f9ad991ec6dacd1dd9db65c
2017-01-10 10:12:03 -08:00
Sam Smith 4d736b9a78 actions: Add token to LINK_ABANDON_*
Change-Id: I7f6187f6c0249c112a08163a343d35ee75cf85e8
2017-01-10 09:50:58 -08:00
Sam Smith 46cd38849e reducers: Store interaction tokens
Consider the user repeatedly dwelling on and abandoning a link. Testing
whether or not the element has changed before modifying state is not
sufficient. Fortunately, we already generate a unique token and include
it in the LINK_DWELL action for use in the eventLogging reducer - the
so-called "interaction token".

Change-Id: Iae9544055f7eccb4f7f071797eb360bc3456861a
2017-01-10 09:50:58 -08:00
Sam Smith f26768afe8 Hygiene: interactionToken -> token
... for brevity.

Change-Id: I03626728fae36176cec0eb844efb92303377bfbf
2017-01-10 09:50:57 -08:00
jenkins-bot 4f6f74035c Merge "Hygiene: Remove hidden preview from DOM" into mpga 2017-01-10 17:47:22 +00:00
jenkins-bot b081b0aa0a Merge "Consistently delay showing previews" into mpga 2017-01-10 17:42:47 +00:00
Piotr Miazga 05eccb31c1 Hygiene: use UserGetDefaultOptions instead of ExtensionRegistration
Changes:
 - removed onExtensionRegistration and related TODOs
 - introduced onUserGetDefaultOptions hook

Change-Id: I6648802c19d90df36a211d6494033aca30c078ca
2017-01-10 18:34:43 +01:00
jenkins-bot b7348f4036 Merge "Fix checkin tests to use fake timers" into mpga 2017-01-10 17:34:35 +00:00
joakin 84043e86f9 Fix checkin tests to use fake timers
* To speed the time the tests spend running
* To make them reliably execute and not depend on magic numbers

Additional changes:
* Use mw.now instead of Date on checkin.js
* Split big setVisibleTimeout test into several smaller ones
  * Extract helpers for the tests

Change-Id: I9d3233fccf6de0997f968d096e375df996e87786
2017-01-10 09:31:32 -08:00
jenkins-bot 538a1d22c6 Merge "Update enable previews copy" into mpga 2017-01-10 02:08:56 +00:00
Sam Smith 1632697c2a Hygiene: Remove hidden preview from DOM
After the preview fade out animation has completed, then the preview
element should be removed from the DOM as it'll never be used again.

Supporting changes:
* Add the preview element to the DOM in ext.popups.Preview#show so that
  it mirrors removing it from the DOM in #hide.

Change-Id: I6b3adc962aa13fbd46dce5f4c4f741299e43c6d9
2017-01-09 15:00:10 -08:00
Sam Smith cbdcf7d353 Consistently delay showing previews
While I1bf953b2 fixed the typo in FETCH_START_DELAY, it didn't do
anything to address the inconsistency in the time it takes to render a
preview (preview delay).

If the gateway result resolves before the target preview delay (500 ms)
is met, then delay dispatching the FETCH_END action until it is. If,
however, the gateway result resolves after the target preview delay,
then dispatch the FETCH_END action immediately.

Supporting changes:
* Expose the fetch action to ease testing it and to help tidy up the
  mw.popups.actions.linkDwell tests.

Change-Id: Idf02343a0417cfbb33093a81d97ecebc5c1c7379
2017-01-09 15:00:02 -08:00
joakin 014d442974 Preview actions+reducer qunit integration tests
Initial approach booting reducers and using actions to manipulate the
state.

Change-Id: I0dba4b2186dd2e092df80fe1806dd320bb829914
2017-01-09 11:53:07 -08:00
Piotr Miazga 05c57ef05f Update enable previews copy
Changes:
 - change english copy for enable previews radio button

Bug: T151058
Change-Id: If52c0ccad1d7345dd7f4063f802cbf7c36cd35f2
2017-01-09 19:41:44 +01:00
Translation updater bot eaebe4cae6 Localisation updates from https://translatewiki.net.
Change-Id: I57c78d6e6e7c738eb4c25c8e538d908dfe347d25
2017-01-09 15:53:49 +01:00
jenkins-bot 7f25a8ce1a Merge "Hygiene: Avoid touching internal state in tests" into mpga 2017-01-04 15:56:28 +00:00
Sam Smith 60adbd0831 Hygiene: Avoid touching internal state in tests
Test what mw.popups.haveCheckinActionsBeenSetup guards against so that
it doesn't have to be touched during the associated test.

Bug: T147314
Change-Id: I315e0782a0e3b1d04878f1ee6f538e54531f7df5
2017-01-04 11:13:34 +00:00
jenkins-bot 605118aa41 Merge "Add reading depth" into mpga 2017-01-04 11:03:01 +00:00
Translation updater bot 71d6647acb Localisation updates from https://translatewiki.net.
Change-Id: Iddf84772198cd0299417c14e6257d7a94c2c6fa1
2017-01-01 10:08:23 +01:00