Commit graph

2212 commits

Author SHA1 Message Date
jenkins-bot 46e072e512 Merge "ParserOutput::getPageProperty() now returns null when key is missing." 2022-02-19 01:47:48 +00:00
jenkins-bot 73f3f79f50 Merge "Update uses of ParserOutput::getPageProperty() to handle new return value" 2022-02-18 17:32:20 +00:00
Translation updater bot 2c575a7abf Localisation updates from https://translatewiki.net.
Change-Id: I772e5eaf53c58d37c5f0da4ddb13115c3d16bf0d
2022-02-18 08:41:09 +01:00
C. Scott Ananian 453c4152af ParserOutput::getPageProperty() now returns null when key is missing.
The return value of ParserOutput::getPageProperty() has transitioned
to returning `null` instead of `false` when the page property is missing.

Bug: T301915
Depends-On: Iaa25c390118d2db2b6578cdd558f2defd5351d15
Change-Id: I1126eab0e882b5bdfecea1ef6e3e27dca7b85115
2022-02-17 11:57:25 -05:00
C. Scott Ananian b87e24813e Update uses of ParserOutput::getPageProperty() to handle new return value
The return value of ParserOutput::getPageProperty() will transition to
returning `null` instead of `false` when the page property is missing.

Bug: T301915
Change-Id: I71628661b4539a4e35ae32846e719f92bcf782e0
2022-02-16 18:26:42 -05:00
jenkins-bot 67d6b77a84 Merge "Move getRawParams helper method to ApiTemplateData class" 2022-02-10 05:44:14 +00:00
Thiemo Kreuz da8969812c Move getRawParams helper method to ApiTemplateData class
This method is not used anywhere else:
https://codesearch.wmcloud.org/search/?q=getRawParams

I tried to make the code a bit more readable. Notable:
* Make use of the return value we get from the preg_… function.
* {{3,} means "the character '{' 3 or more times". {{{+ does the
  same. Note the { doesn't need to be escaped when it's not
  followed by a number.
* At the end, it doesn't make any difference when we scan for
  optional closing brackets. The moment we find at least 3 we are
  done.

The test is intentionally not moved. This is something for a later
patch.

Bug: T301337
Change-Id: I55e31ceecea2ae7c35bcfbc2d641b35f751820db
2022-02-09 12:37:33 +00:00
Thiemo Kreuz b1a4a27531 Split and streamline HTML formatter code
Bug: T301337
Change-Id: Ic2dac65e6e54411abc33326abf8d0fab148cb784
2022-02-09 12:37:29 +00:00
jenkins-bot 5407262418 Merge "Improve test coverage for HTML formatter code" 2022-02-08 16:09:17 +00:00
jenkins-bot a64ed0a376 Merge "Fix/narrow visibility of several methods" 2022-02-08 15:54:22 +00:00
Translation updater bot b7c4342c74 Localisation updates from https://translatewiki.net.
Change-Id: I9503bf3e3089f8f0efef27ca9fe4876d65c807f6
2022-02-08 08:29:02 +01:00
Translation updater bot abffa4a74d Localisation updates from https://translatewiki.net.
Change-Id: Ide88f7c89175f8e33144c9dfb19f5650d4b89977
2022-02-07 08:23:00 +01:00
jenkins-bot 8793641465 Merge "Move last remaining HTML formating code out of blob class" 2022-02-04 17:06:25 +00:00
Translation updater bot 01fead0f98 Localisation updates from https://translatewiki.net.
Change-Id: Ib521e7642b668679293c69019ed0f0b5e5eec415
2022-02-04 08:22:36 +01:00
Thiemo Kreuz a81a8b52bc Improve test coverage for HTML formatter code
… as well as some smaller improvements to the test coverage of other
code.

Change-Id: I5bec9c456fdc597c340dc0b515d23d837a7c5651
2022-02-03 12:45:27 +01:00
Thiemo Kreuz b674294789 Fix/narrow visibility of several methods
One method is only public to be able to test it. Others look like
they have been made "protected by default", which is not needed
anywhere.

Change-Id: Ib2231f0b2a879323aa53f8d40a175527c5b131d8
2022-02-03 10:48:04 +01:00
Thiemo Kreuz 001494f443 Move last remaining HTML formating code out of blob class
Effectively a no-op. This patch doesn't change what the code does.
Tests are in place to prove this.

As before, the tests are intentionally not moved but left in place.
This is for later patches to clean up.

Change-Id: If130e0d006a36d8c755288f8a4e4e9a4c42a6295
2022-02-03 09:33:03 +01:00
Translation updater bot 1df51d8259 Localisation updates from https://translatewiki.net.
Change-Id: I2e6858e678871ddcd11fbd189d5b9e6254902730
2022-02-03 08:44:39 +01:00
jenkins-bot 59e582cfb6 Merge "Split validation into some smaller steps" 2022-02-02 14:39:59 +00:00
jenkins-bot bd531c2a68 Merge "Use more specific instanceof stdClass instead of is_object()" 2022-02-02 12:31:35 +00:00
Thiemo Kreuz 78e6239444 Split validation into some smaller steps
Bug: T260980
Change-Id: Ibc88b5fd8f8ece919032d13320cad74d9be74bfc
2022-02-02 12:18:34 +00:00
jenkins-bot deeea30725 Merge "Inject localizer service into HTML formatter class" 2022-02-02 11:54:05 +00:00
Thiemo Kreuz dc82db422b Use more specific instanceof stdClass instead of is_object()
PHP is a little weird in so far that what you get from e.g. `(object)[]`
or json_decode() are not objects but stdClass instances. You can think
of stdClass as a subclass of object, i.e. it's more specific.

Using is_object() means that stuff like ArrayIterator will be accepted,
which is not correct in this context here.

Change-Id: I0bffc54508ac7a27bbb59c3aabb9695158eb96b3
2022-02-02 11:45:59 +00:00
jenkins-bot 606ed3642b Merge "Rename all $paramObj to $param" 2022-02-02 11:38:42 +00:00
jenkins-bot 5726af0e30 Merge "Split validation and HTML formatting into separate services" 2022-02-02 11:35:23 +00:00
jenkins-bot e6efeb59d8 Merge "Replace effectively unused $paramNames array" 2022-02-02 11:24:16 +00:00
jenkins-bot 4b3a7fa4e3 Merge "Fix use of formatnum in templatedata-invalid-length" 2022-02-02 08:16:16 +00:00
Thiemo Kreuz 94573e1152 Inject localizer service into HTML formatter class
Change-Id: I7f27b0c42e15ab939749c9dbe9eb51754580ca87
2022-02-01 15:59:32 +01:00
Thiemo Kreuz 15aa40aa1d Rename all $paramObj to $param
The word "param" is not really that ambiguous in this context. The
only other meaning it could have is "parameter name". Such places
already use $paramName.

This makes the following patches easier to review.

Change-Id: I1e6210d1ca7d58726a0fc3b3396d75e0e28c16d8
2022-02-01 15:47:53 +01:00
Thiemo Kreuz 8c24751491 Split validation and HTML formatting into separate services
No functional change was made to the code. It was only moved from one
place to another. Note there are a lot of tests that cover this code.
The tests haven't been touched on purpose. Splitting these as well
is something for a later patch.

Bug: T260980
Change-Id: I9fa0fa87768f2560b83a1b5f3d39211ea9d6cfad
2022-02-01 15:47:52 +01:00
Thiemo Kreuz c6822649d5 Replace effectively unused $paramNames array
All this effectively does is counting the number of properties in the
$data->params object.

Change-Id: I92fff1f70b4f583c27c0e0ba7e4d7239e7790ee3
2022-02-01 15:45:33 +01:00
Translation updater bot f421e4951d Localisation updates from https://translatewiki.net.
Change-Id: I4850db9250c053023f10f0b2f758a7c0910a8336
2022-02-01 08:27:34 +01:00
Niklas Laxström 6725472575 Fix use of formatnum in templatedata-invalid-length
PLURAL magic word expects formatted numbers, so just format them
in the code already, as is common practice.

Change-Id: I813c45f8959d9d013a6176e999622c81f7e86042
2022-01-31 09:34:57 +02:00
Translation updater bot 59ebd83170 Localisation updates from https://translatewiki.net.
Change-Id: I291526038f454c6e1bfee2b16392f5ce6f32038a
2022-01-31 08:22:38 +01:00
WMDE-Fisch 8c36f324e1 Fix use of errorbox in TemplateData
Bug: T300349
Change-Id: Ic4dbc1235887f29cb7737c0e1d4a3efe047c719b
2022-01-28 15:17:07 +01:00
Translation updater bot 5d643de66e Localisation updates from https://translatewiki.net.
Change-Id: I31347da0474f25cc8eafef8349e9cb091b0b83b7
2022-01-28 08:34:32 +01:00
jenkins-bot cd2484bec6 Merge "Localisation updates from https://translatewiki.net." 2022-01-27 01:05:51 +00:00
Translation updater bot c596db6882 Localisation updates from https://translatewiki.net.
Change-Id: I50186affd0b064f19836b49893c9015fceb2fb6d
2022-01-26 08:25:35 +01:00
Translation updater bot 2743704d3f Localisation updates from https://translatewiki.net.
Change-Id: I673688076fb29249f2a6ae2c55a458cc57f8cb72
2022-01-25 08:33:21 +01:00
Translation updater bot 0678b39f39 Localisation updates from https://translatewiki.net.
Change-Id: If921cf3207f338eab8729b269ef5b02ad9adbc68
2022-01-20 09:18:12 +01:00
Translation updater bot 748385bfb0 Localisation updates from https://translatewiki.net.
Change-Id: Ifb851275b8261ecac761277e8c2d2171e8bc24c6
2022-01-19 08:24:27 +01:00
Translation updater bot 72acb5fe93 Localisation updates from https://translatewiki.net.
Change-Id: I524a96915f47167f3186c9da3d02fd8a6457e92e
2022-01-18 08:11:20 +01:00
jenkins-bot c8537793c1 Merge "Fix and update type hints in JSDoc comments" 2022-01-17 17:11:19 +00:00
Translation updater bot 400ca82c9b Localisation updates from https://translatewiki.net.
Change-Id: I215afff889d2296556e7aa7a4c8b026f61ae1c61
2022-01-17 08:13:05 +01:00
jenkins-bot ddc0f91eff Merge "Passing a string to ParserOutput::addModules()/addModuleStyles() is deprecated" 2022-01-12 14:27:03 +00:00
Translation updater bot 9478f40638 Localisation updates from https://translatewiki.net.
Change-Id: Ia6e2e0bd6809f834232091be138006b92ac5fb4f
2022-01-12 08:25:38 +01:00
C. Scott Ananian 0a3b28d3de Passing a string to ParserOutput::addModules()/addModuleStyles() is deprecated
Bug: T296123
Change-Id: I9b7fe5acee73c3a378153c0820b46816164ebf21
2022-01-11 17:02:39 -05:00
Thiemo Kreuz 5f749c6418 Allow aliases to be integers in addition to strings
Parameter names in a template can be numeric. While it makes a lot of
sense to force a specific format in the TemplateData JSON (i.e. only
strings), it's inconvenient and confusing if numbers are rejected for
being "invalid".

Effects of this patch:
* The incoming JSON is allowed to contain numbers in the aliases
  array.
* However, the API normalizes these and forces all aliases to be
  strings, as it was always documented.
* The editor component accepts anything in the aliases array, but
  forces all aliases to be strings. Again, as documented.
* Note that it was never possible to use numeric keys in the `params`
  list. This patch is only about aliases.

At the moment this is a somewhat "hidden" feature. We might or might
not update the documentation to officially allow numeric aliases.

Bug: T298795
Change-Id: I32ea296b4520e7f21b03a1f6390db4f43b613bdd
2022-01-10 13:33:27 +01:00
Thiemo Kreuz e79f19f09c Fix and update type hints in JSDoc comments
Change-Id: Ib38d3c4eff7630bd3aed04beee33adc5ae2101f3
2022-01-10 11:48:42 +01:00
Translation updater bot e296c87ad2 Localisation updates from https://translatewiki.net.
Change-Id: Ib26fedc0182efd5178631db1e12cfabde34b8854
2022-01-06 08:32:09 +01:00