Commit graph

7503 commits

Author SHA1 Message Date
jenkins-bot 416323bdca Merge "Fix media embeds which don't link to the file page" 2019-10-18 10:55:58 +00:00
Bartosz Dziewoński 6037fefbe0 Fix media embeds which don't link to the file page
Follow-up to da9b6fffbd.

Bug: T235707
Change-Id: Ie5a12bf274ae6178106f81a4c84686a88307c9fb
2019-10-17 22:12:58 +02:00
Bartosz Dziewoński 5d1a67757a Detect mangled etags from RESTBase and retry via MediaWiki API
Something is causing the 'ETag' headers produced by the "public"
RESTBase (queried directly from the client) to be mangled or lost.
My theory is that some proxy or browser extension is doing that.

When we detect a bad etag when fetching the page contents, discard
the result and try querying the "private" RESTBase via the MediaWiki
API (similar to what we do on private wikis, except there we talk
directly to Parsoid instead of RESTBase). After I463a84de63, that
returns the etag as part of the payload rather than HTTP headers,
and should pass unharmed through whatever is mangling the data.

Also compare and log the two etags.

Bug: T233320
Change-Id: I2ef0ca872597566f74b650aea71bf3f15747a6d7
2019-10-16 19:53:43 +02:00
jenkins-bot b15eea1cb0 Merge "Fix Vector wikitext surface padding overrides when using custom browser font-size" 2019-10-11 15:23:17 +00:00
jenkins-bot cc1bd58e83 Merge "Parse relative hrefs on image nodes like on regular links" 2019-10-11 15:22:29 +00:00
Bartosz Dziewoński 3f0f302577 Enforce that some files must not use the ve global
Previously, the ve-mw/init/ directory contained two kinds of files:
those that were used when initializing VE, and those that may be
loaded even if VE is not going to be initialized at all. The latter
kind must not use the `ve` global variable.

After moving those files to ve-mw/preinit/ we can enforce this with
.eslintrc.json in that directory. This would have prevented T228684.

(Technically they merely must not use `ve.init`, and may use `ve`,
but that's harder to enforce. We should instead move the few non-init
methods out of `ve`: now, track, trackSubscribe, trackSubscribeAll).

Also, group some files under ve-mw/init/: targets/ now (only)
contains ve.init.mw.Target and its subclasses, apiresponsecache/
now contains ve.init.mw.ApiResponseCache and its subclasses.

Bug: T228684
Change-Id: I945249a27f6a0fa10a432d5c5dc57bc7e0461fd8
2019-10-10 15:15:40 +00:00
jenkins-bot def3261c49 Merge "Fix linking to pages in media dialog/media context/internal link context" 2019-10-07 15:13:02 +00:00
Bartosz Dziewoński 55aec8f977 ve.ui.MWDefinedTransclusionContextItem: Fix handling of template names
The ...target.wt property contains the wikitext used to generate
the template name. It can contain trailing newlines (T234817) and
all kinds of funny wikitext syntax. Instead, use ...target.href,
which is the title of the page that is actually transcluded. Compare
the new code to ve.dm.MWTransclusionNode.prototype.getPartsList.

Additionally, fix some confusion about namespaces (treating template
names as titles in the main namespace). The template names in the
configuration page (visualeditor-template-tools-definition.json)
now support overriding namespaces in the same way as in wikitext.

Bug: T234817
Change-Id: I7c557d28e961d0b9117fc0380c65cdd42035ae96
2019-10-07 14:56:16 +02:00
Bartosz Dziewoński 7579f6eb1f Fix linking to pages in media dialog/media context/internal link context
If you had an image thumbnail for a file 'Foo?.png' on the page,
ve.ui.MWMediaContextItem and ve.ui.MWMediaDialog did not escape
the '?' when linking to it, which resulted in incorrect links.
Similarly, if you had an internal link to the page 'Foo?',
ve.ui.MWInternalLinkContextItem did not escape it.

Additionally, the links were always generated as if the wiki was
using short URLs, even when it is not (T233628).

The approach using mw.Title is copied from ve.ui.MWGalleryDialog.

Bug: T233628
Change-Id: I10256ed6883dae0ea216de4c0719f03d7fd19ae4
2019-10-07 14:27:02 +02:00
David Lynch d03db0e4f2 ui.MWSaveDialog: checkbox tracking was getting duplicated on every setup
Bug: T232790
Change-Id: Id19aa59c71432d0179fc06b6a30014d1037074ae
2019-10-03 12:44:43 -05:00
Ed Sanders 41572f2595 build: Update eslint-config-wikimedia and fix
Change-Id: Ib9cf45a393438e2eb47fd1b0c837d2d6acb06541
2019-10-03 00:54:54 +01:00
jenkins-bot 73a92d847d Merge "ArticleTargetEvents: clean up some duplication" 2019-09-30 23:49:27 +00:00
David Lynch 651e00d529 ArticleTargetEvents: clean up some duplication
Change-Id: Ied2851f9d77d055db9fc22668b963a01ca098a95
2019-09-30 11:29:01 -05:00
Bartosz Dziewoński da9b6fffbd Parse relative hrefs on image nodes like on regular links
* In normal images, parse relative 'href' attributes instead of
  expanding them to absolute, and parse 'resource' to keep it
  identical to 'href' if they refer to the same page (including
  same percent-encoding and space/underscore). This resolves Parsoid
  generating |link= options for copy-pasted images (T193253).

* In gallery images stuff, prefix the 'resource' attribute with './',
  same as normal images do. This causes no functional changes, but it
  makes updating tests easier, and the consistency is probably good.

* Update test examples to also prefix 'resource' and relative 'href'
  attributes with './', like the real Parsoid does.

Bug: T193253
Change-Id: If2d7f080d9d693568054f8311c1e1b15ca27ea5c
2019-09-25 00:25:04 +02:00
Bartosz Dziewoński e472a4bbd3 Fix mw:MediaLink support
* Handle mw:MediaLinks pointing to to non-existent files, which come
  with typeof="mw:Error" (similar to image nodes).

* Fix regression from c66f8e0547, which
  caused all mw:MediaLinks to be treated as plain external links again.

* Add test cases.

Bug: T232754
Change-Id: I9ae5bcfc4e24e8c0d22ef77d6a4d03f817fc9768
2019-09-24 22:46:03 +02:00
TheSandDoctor 70e3e7cc8b VisualEditor: Replace deprecated editToken with csrfToken
The editToken key of mw.users.tokens is deprecated since MediaWiki 1.27.

Bug: T233528
Change-Id: I7297e6abb159e9bb758859454b1097292e607117
2019-09-22 10:22:01 -07:00
jenkins-bot 7f7cf6ce79 Merge "MWInternalLinkAnnotationWidget: adjust the input for relative links to subpages" 2019-09-20 11:23:40 +00:00
Bartosz Dziewoński 69147ce3bc Fix Vector wikitext surface padding overrides when using custom browser font-size
In order to get the desired padding, the `em` values were pre-multiplied
by the parent font-size, which was assumed to be `0.875em` for normal
surfaces and `(13.3333/16)em` for wikitext surfaces. (That should have
been `(13/16em)`, by the way, but that's a negligible difference.)

Unfortunately, the font-size for wikitext surfaces is actually `13px`.
Unlike `em`, `px` values are not affected by custom browser font-size,
so when one was set, the final padding was all out of whack.

Use `rem` units instead to respect the custom browser font-size,
without getting problems due to the parent element font-size.
We don't need separate rules for .ve-ui-mwWikitextSurface now.

Bug: T222217
Change-Id: Ib7ffbf09d5aa23fddb894aa3b081ec993ddcee2d
2019-09-18 22:24:47 +02:00
jenkins-bot 067ec50ff8 Merge "MWSaveDialog: add more instrumentation" 2019-09-18 15:13:10 +00:00
David Chan c4cb88aded Don't unwrap a solitary paragraph in Wikitext string transfers
This meant we were returning invalid documents with bare content outside
content branch nodes. Instead let ve.ce.Surface in VE core do the unwrapping.

Bug: T232944
Depends-On: I8799d51958b966c99307f4c70546ea326e67385c
Change-Id: I0479116b51cc3135a992fdf36b8edfb2c44916ba
2019-09-17 20:44:45 +00:00
David Lynch 001ed6a88e MWSaveDialog: add more instrumentation
Bug: T229079
Change-Id: I2e5b45a4a28b580fbca872d620df94a61fb8a24a
2019-09-16 10:48:31 -05:00
jenkins-bot 6c52d4b9da Merge "ve.init.mw.MobileArticleTarget: Really deactivate the surface" 2019-09-12 16:43:05 +00:00
jenkins-bot a7a4886a54 Merge "Add new EditAttemptStep stage: firstChange" 2019-09-12 15:19:46 +00:00
jenkins-bot b75eb54bec Merge "Add another looser selector for catching pasted references" 2019-09-10 17:14:31 +00:00
David Lynch 22461568e0 Add new EditAttemptStep stage: firstChange
Depends-On: I79e04dda6323ebb05b129bb96c0323db112bcdd0
Bug: T229079
Change-Id: Icea7eed8a56e0c5a94c6dba4b0951ecf5f594da1
2019-09-10 10:41:13 -05:00
Ed Sanders 0371915832 Add unit tests for read-mode reference filter
Bug: T150418
Change-Id: I8b39694d5c01e0902491fe3d6f3a08451c7c5297
2019-09-10 14:46:45 +00:00
Ed Sanders 90426ba496 Use MW import rules in MW tests
Bug: T150418
Depends-On: I6ad87b53446d7d9fcaf82e1d60e3f9968c4409b6
Change-Id: I5d7f24a7e36ddd3624ef120783ceec5063cf3711
2019-09-10 14:46:37 +00:00
Ed Sanders c8582df1b9 Add another looser selector for catching pasted references
Bug: T232461
Change-Id: I82eef25fbbaa4b583fac660b172541db3160c99c
2019-09-10 12:32:10 +01:00
Bartosz Dziewoński 8eef588593 ve.init.mw.MobileArticleTarget: Really deactivate the surface
The call to selectFirstContentOffset() below would re-activate the
surface and (attempt to) show the keyboard if the surface was
deactivated, but not shown as deactivated.

This might have worked correctly by accident before
I39fe44eee8eab7129340bcff796b6b9b3a59a398 in VE core.

Change-Id: I500309cc0aa8cd794175ae683a17c2614fd58cc9
2019-09-09 20:00:53 +02:00
jenkins-bot a3eb620570 Merge "ve.ui.MWEditModeTool: Fix showing active editor" 2019-09-09 17:55:33 +00:00
jenkins-bot 03bdace1ba Merge "MobileArticleTarget: don't access the surface after it's destroyed" 2019-09-09 16:35:18 +00:00
Bartosz Dziewoński a02323698b ve.ui.MWEditModeTool: Fix showing active editor
This line of code seems to have been accidentally deleted in
1761b6d6d6.

Bug: T232359
Change-Id: I7d9568cc11a7c96e607203d41ab132c6f304d304
2019-09-09 18:32:56 +02:00
David Lynch 74d7fe01be MobileArticleTarget: don't access the surface after it's destroyed
Some post-save scrolling would try to access the view before the
handlers were cleaned up.

Bug: T232347
Change-Id: I30433ef027c52d541351972f8ebb09fe6d45e436
2019-09-09 10:01:34 -05:00
jenkins-bot f12cb6d1cf Merge "MobileArticleTarget: Remove unused code (adjustContentPaddingDebounced)" 2019-09-06 21:26:51 +00:00
jenkins-bot 5bbcf9bac1 Merge "MobileArticleTarget: Remove unused code (hideSpinner)" 2019-09-06 21:22:25 +00:00
Bartosz Dziewoński a1a082aafa MobileArticleTarget: Remove unused code (adjustContentPaddingDebounced)
As of I6c043e039fbef62a56f475b0dc365e171ab7bf59, this method is never
called. It was previously used to update the size of the toolbar when
context menus were displayed inside it, but they are now displayed
elsewhere.

Change-Id: I53030de1203a7f0d75780ae796bbb10082d5ef7a
2019-09-06 21:27:47 +02:00
Bartosz Dziewoński 08e16c0053 MobileArticleTarget: Remove unused code (hideSpinner)
As of I2f2495ab6c10116a6660f4361e49272cb95b988a in MobileFrontend,
the overlay never uses the default spinner.

Change-Id: Ie0aa624e33a5bd21fc20459697cca175d9de5606
2019-09-06 21:25:17 +02:00
jenkins-bot 19ca9a4768 Merge "Update VE core submodule to master (0b17a137b)" 2019-09-06 00:17:08 +00:00
James D. Forrester a05f9e4bf4 Update VE core submodule to master (0b17a137b)
New changes:
d4cb2f03e Update OOUI to v0.34.0
b0b481693 jsduck: Stop listing OOjs in upstream, it's using JSDoc now
0b17a137b Update OOjs to v3.0.0

Change-Id: If29a97ce689523763431face5a13929a461735b4
2019-09-05 13:03:41 -07:00
Ed Sanders af0ca43125 Mobile surfaceReady: Account for selection changing in listeners
Bug: T232136
Change-Id: Ia49ea99320a8191a4d73703f1cbf3b9ef89035ec
2019-09-05 19:25:33 +01:00
Ed Sanders 7f854ff6ca Fix HTML blacklist inheritance
Bug: T150418
Change-Id: Ic56f90d654bfd34e353edafbbf5954fe167157f6
2019-09-04 17:14:38 +01:00
Ed Sanders 901f107bd0 Delete mobile toolbar flexbox code, upstreamed to VE core
Depends-On: If973baa556a557c2fe5cb3aed44f937fc9d2b62e
Change-Id: I775fb24bd16572cfb8472f5260a7552b2fbb9930
2019-09-03 17:30:19 +00:00
David Lynch 828aad2e01 MWLinkAnnotationInspector: track edits to the label field
Bug: T229841
Change-Id: If5aa535015260a315f02f9e694f1fcb533928b08
2019-09-03 09:19:09 -05:00
Bartosz Dziewoński 91f99ce78d ve.init.mw.DesktopArticleTarget.init: Update for Minerva changes again
The good thing is that every time our CSS overrides get less crazy.
See 75ff121b29 for the last time.

Change-Id: I9d81aff6a24ec28850563e00206e21c4a6593d2e
2019-08-30 21:40:40 +00:00
jenkins-bot bc963f4155 Merge "Support for defined template context items" 2019-08-30 18:50:27 +00:00
jenkins-bot 6cd05557d0 Merge "MobileArticleTarget: v1 of toolbar refresh" 2019-08-30 17:43:58 +00:00
Ed Sanders e5f5a49344 Support for defined template context items
Context items can be created for specific template titles. Titles
are mapped to context items using an on-wiki message.

Bug: T211243
Change-Id: Icfc39e350452da238d0e0c17cb2305c60d9ca16a
2019-08-30 13:02:47 +01:00
David Lynch 593d26b4ab Don't let double-clicking the save button trigger a save
Tapping the toolbar save button while the save dialog is open triggers a save
because of the accesskey. It shouldn't save on a double-tap, because that's
easy to accidentally do / trigger on a slow device.

Bug: T230816
Depends-On: I4c3afce9d57c9bca737272b40b9a4862b5794bac
Change-Id: I1925b1b97de6a811f73196b616ec09a2c30c336f
2019-08-29 22:43:53 +00:00
David Lynch 1761b6d6d6 MobileArticleTarget: v1 of toolbar refresh
Bug: T211789
Bug: T230807
Change-Id: Ifd2319039628a8143dc09f6fa35e4a9825d3062c
2019-08-29 15:27:56 +00:00
jenkins-bot dd86fc76aa Merge "Use upstream pulsating dot" 2019-08-28 17:31:52 +00:00