Commit graph

2304 commits

Author SHA1 Message Date
Ed Sanders 2d55fa64b1 Use a MessageWidget for the sub-page warning
Change-Id: I8b2878a9a817d14d3a4542a083e98a9f70cfde8d
2020-10-04 14:05:26 +01:00
Translation updater bot 71627e9061 Localisation updates from https://translatewiki.net.
Change-Id: I70fd304ef0940e45444d30a3820051e47f91186e
2020-10-02 08:25:12 +02:00
libraryupgrader 44b26329b5 build: Updating mediawiki/mediawiki-phan-config to 0.10.3
Additional changes:
* Dropped .php5 files from .phpcs.xml (T200956).

Change-Id: I009704249014f2be31f60cf8de2f9732c24e8652
2020-09-25 10:34:56 +00:00
Thiemo Kreuz de434822b4 Fix all eslint warnings
Change-Id: I731ea4a54b001a8d30743ca32188edb1c039253e
2020-09-24 13:31:18 +01:00
Ammar Abdulhamid 0b03b04dcc Force tag content to string before constructing TemplateDataBlob object
This null was being forced to string by PHP before strict typing in I9a20335

This is a rare error as self-closing tag is not allowed as far as
I can see and will emit proper syntax error after this change; but
it should not raise fatal exception

Bug: T263605
Change-Id: I1d9f674fb92d1f1cf70b57e820f8fc3312be9cc8
2020-09-23 05:35:37 +01:00
Thiemo Kreuz f6de5d3493 Fix parameter extraction from wikitext source
This fixes a series of issues:
* The JS implementation had a trim() in one place that was
  missing in PHP.
* The actual parameter name in the paramNames/$params array was
  trimmed, but the "normalized" name (this is only for duplicate
  detection) was not trimmed.
* It was possible for an empty parameter to show up.

This resulted in very strange behavior, e.g. {{{ 1}}}{{{1 }}}
was detected as "1" and "10" (?), i.e. it would try to renumber
the duplicate in a strange way (string "1" plus a counter that
starts with 0).

Change-Id: I0a6371f3633b03b5b21809ecd06ea4c72d7d914d
2020-09-22 18:27:23 +02:00
Translation updater bot e446676c91 Localisation updates from https://translatewiki.net.
Change-Id: I88b99a6a80da23676cd930ecf76956384d0c4e9b
2020-09-22 08:35:29 +02:00
Translation updater bot 3778a345ac Localisation updates from https://translatewiki.net.
Change-Id: Ic41baa98cd6962ab3f22891284a5618917d2c9af
2020-09-21 08:30:37 +02:00
jenkins-bot 077cb83cc9 Merge "Add and update soft PHPDoc type hints" 2020-09-21 01:00:27 +00:00
jenkins-bot 6d6ef56ea2 Merge "Prefer Html::rawElement instead of open/closeElement" 2020-09-21 00:53:23 +00:00
Thiemo Kreuz 0323e78308 Add missing ResourceLoader module for the trash icon
Without this, there is no guarantee the icon is there.

Bug: T258820
Change-Id: Ibe16db80ba8aec53477c48553c8f9c244d9f9a3b
2020-09-18 15:53:40 +02:00
Thiemo Kreuz fa7d16a373 Update a few confusing variable names in editor code
Change-Id: I8e7bc84539e62784059e0a43ca3de48c31abe6cf
2020-09-18 15:50:51 +02:00
Thiemo Kreuz 9f878897cf Turn static variables into private constants
These are not really variables. They are never modified, and not
meant to be modified. Using "static" was a common workaround
when we had no private constants in PHP.

Change-Id: Ie1234ce8833986431be95f8537282fa174978063
2020-09-14 14:17:25 +02:00
Translation updater bot 32f032b597 Localisation updates from https://translatewiki.net.
Change-Id: I6de788f2b8d9ca1c4fe32b9e77b1987c40c0b03b
2020-09-14 09:16:24 +02:00
Translation updater bot 08fcc89d8e Localisation updates from https://translatewiki.net.
Change-Id: I9c43b672d7083fbbfda9dae35ef248cbe588eb47
2020-09-10 09:50:06 +02:00
Thiemo Kreuz ac0630edd1 Add all missing PHPDoc comments
Change-Id: I4bf77867209e8aef524707b02363ae0ff7ca1f2a
2020-09-09 17:05:54 +02:00
Thiemo Kreuz eeffc4bf38 Prefer Html::rawElement instead of open/closeElement
Html::open/closeElement are hard to read and possibly error
prone. We can easily avoid it in this case here.

Change-Id: I2251cb63e58bc132ced0bb684e3f0e3be35ab1aa
2020-09-09 16:54:59 +02:00
jenkins-bot 6dd0b66fea Merge "Make TemplateDataBlob::normaliseInterfaceText() private" 2020-09-08 22:45:15 +00:00
jenkins-bot 8e56813b6e Merge "Use more canonical (object)[] instead of new stdClass" 2020-09-08 22:45:13 +00:00
jenkins-bot 3319103531 Merge "Make properties in TemplateDataBlob private" 2020-09-08 22:17:40 +00:00
jenkins-bot 81c7cc823e Merge "Make subclass constructors properly call each other" 2020-09-08 22:17:39 +00:00
Translation updater bot 750b4f53f4 Localisation updates from https://translatewiki.net.
Change-Id: I3f3c4b9bf9b891733e41d38cfebc6fc172654eae
2020-09-08 10:25:27 +02:00
Translation updater bot dca6117405 Localisation updates from https://translatewiki.net.
Change-Id: I501c350459c4c7fba6616e3ec11aa5a08fdcc67b
2020-09-06 20:56:52 +02:00
libraryupgrader e96711d7bb build: Updating npm dependencies
* eslint-config-wikimedia: 0.16.2 → 0.17.0
  The following rules are failing and were disabled:
  * no-shadow

* grunt: 1.2.1 → 1.3.0

Change-Id: Id43b02523bb5e0a706f64c1a40d1c1841aa3d345
2020-09-04 23:21:12 +00:00
Thiemo Kreuz f2306a2eab Make properties in TemplateDataBlob private
No subclass is directly using these. They don't need to be
protected. There are getters, if needed.

Change-Id: I27dcb8bee37b9559242451774c52240b490a18af
2020-09-04 15:28:15 +00:00
Translation updater bot 060dc52f44 Localisation updates from https://translatewiki.net.
Change-Id: I33eb67c0371614ed7edb6ca7c9c2a4157ef56c47
2020-09-04 09:28:23 +02:00
Thiemo Kreuz a4813c26f3 Add and update soft PHPDoc type hints
In detail:
* Callers don't need to know that the return value can be a
  TemplateDataCompressedBlob. All relevant stuff is declared in
  the base class.
* It's not relevant which internal method returned the status.
  It's just the status of the object after it was constructed.
* "stdClass" is more specific. "object" includes more stuff
  which can't be returned here.
* Avoid duplication and use @inheritDoc instead.

Change-Id: I68878a5b26ecd566fbea88b513ee697b45769659
2020-09-04 06:10:24 +00:00
Thiemo Kreuz 53d6c2fcd9 Make subclass constructors properly call each other
In detail:
* Mark both as protected and make them call each other.
* Avoid duplication.
* Remove unused "null" default value.

Change-Id: I272a68bb3cc0c544ef306b16c2998458c2eb1a2d
2020-09-04 06:09:35 +00:00
Thiemo Kreuz 62c608f172 Add strict type hints in unambiguous places
Notes:
* In PHP, when a function parameter does have a strict type,
  all it does is forcefully casting the value to this type. It
  doesn't cause warnings.
* Violating a strict return type causes a warning.
* I'm intentionally not touching places where the result from
  json_decode() is passed through. In theory this could be
  anything. Let's update these later, after more refactoring
  is done.

Change-Id: I9a203356f70cf9edd434f7dc4ca130c2b7605ab4
2020-09-03 12:12:19 +02:00
Translation updater bot 8b235cbbb6 Localisation updates from https://translatewiki.net.
Change-Id: I60d70182799e8abc399dbf84c81e16da143fbc84
2020-09-03 10:05:21 +02:00
jenkins-bot e0c9c4c2ca Merge "Add map to Qunit tests" 2020-09-02 09:35:54 +00:00
Translation updater bot ba7f04c0f0 Localisation updates from https://translatewiki.net.
Change-Id: I163c3798cae5f6d82d3cb8693852ec841f21d4db
2020-09-02 09:41:16 +02:00
Thiemo Kreuz 47e8249349 More canonical property order in mw.TemplateData.Model class
This does not have any effect on how this code behaves. It's
only relevant when a human reads the code. I tried to bring the
properties in an order that makes the most sense, grouping stuff
that clearly belongs together, as well as following how stuff is
ordered on
https://www.mediawiki.org/wiki/Extension:TemplateData

Change-Id: Ibbe1027023f8d87bbd0a70411882a25671918670
2020-09-01 09:10:34 +00:00
Translation updater bot 84159109e8 Localisation updates from https://translatewiki.net.
Change-Id: Ia2d2bbbcdbed7ac3bb264061372044682af161de
2020-09-01 09:18:32 +02:00
Thalia f3f3821b3d Fix punctuation for message in the edit dialog
Change-Id: Ib5dcd86fdd982caec87983eedee140506de7068b
2020-08-31 11:52:05 +01:00
Translation updater bot 69848ec021 Localisation updates from https://translatewiki.net.
Change-Id: Ibac578185014907520869f3b561b92385c145077
2020-08-31 09:49:37 +02:00
jenkins-bot c42a4afede Merge "Allow different maps to be edited separately" 2020-08-30 16:14:59 +00:00
Marielle Volz 9760fed11d Add map to Qunit tests
Add roundtrip test where a maps object is present.

Bug: T261406
Change-Id: I620e60599a28c677f1af6231f36bdb39658afb7a
2020-08-30 15:07:03 +01:00
Khatean 76cf63dad2 Allow different maps to be edited separately
Seperate different maps of maps-object into different panels that
contains text-area to edit the map, delete button to delete the map, and
can be navigated through using a side-bar, that also have "Add new map"
button at the top to add a new map.

Bug: T258820
Change-Id: Ib53a73203f6010b3fd8a5cd78c74c904be2340f2
2020-08-28 20:18:27 +02:00
Thiemo Kreuz a2415bb32a Turn static property into private constant
We can do this in PHP now.

Change-Id: I54ae244651134424d5a2b1ce27d685f8165692da
2020-08-26 13:00:26 +02:00
Thalia 1cd8a4719a Fix Gruntfile.js path for stylelint
Change-Id: I19d214f409455cf3179b3e0d57617909f8f44cad
2020-08-25 16:01:44 +01:00
Thiemo Kreuz 4853c2ae3a Remove unused "changesBooleanValue" property
Not used anywhere:
https://codesearch.wmcloud.org/search/?q=changesBooleanValue

Change-Id: I40f08f4d7164dbcb7bef58bb647607573f852f15
2020-08-25 14:18:54 +02:00
jenkins-bot 269ef3c3af Merge "Move "Unknown" type to the top of the dropdown" 2020-08-25 00:11:25 +00:00
Translation updater bot 06a7201f2d Localisation updates from https://translatewiki.net.
Change-Id: Ieac7c0ce7841ac9e8f4839c27c653333a2225d2c
2020-08-24 11:59:13 +02:00
jenkins-bot b442c40255 Merge "Remove obsolete return true and & from hook handlers" 2020-08-20 15:45:21 +00:00
jenkins-bot 4a45fd6cbf Merge "Remove unused variables" 2020-08-20 15:07:00 +00:00
Thiemo Kreuz 1d798c0e43 Remove redundant null check after isset()
isset() already checks if a thing a) exists, and b) is not null.

Change-Id: I5291ee30c8897dda1a5c095e196d5b5477a1877b
2020-08-20 12:20:58 +00:00
Thiemo Kreuz a5fe1bfbb9 Move "Unknown" type to the top of the dropdown
"Unknown" is the special, default value when nothing else is
specified. It feels wrong to find this in alphabetical order
between all the other values, as if "Unknown" is something I'm
expected to pick. While this is possible, it's almost never
necessary. "Unknown" is the default anyway. If I'm fine with
that, I never change it. But if I want to pick something else,
I typically expect the list to show the "nothing selected yet"
default first so I can easily avoid it.

Change-Id: I283a1b0545efba208af777a0b2056740263dfc32
2020-08-19 17:30:05 +02:00
Thiemo Kreuz 10971b6124 Make TemplateDataBlob::normaliseInterfaceText() private
Not used anywhere else:
https://codesearch.wmcloud.org/search/?q=normaliseInterfaceText
Doesn't even need to be static, as it is never called from a
non-static context.

Change-Id: I0981392e18cab08fb19501f57d805caf8f57dd4a
2020-08-19 15:40:55 +02:00
Thiemo Kreuz c355a8fac4 More strict validation of InterfaceTexts
This fixes parts of a TODO in the code. Specifically:
* When an InterfaceText is an object, it can not be any object,
  but must be an stdClass.
* It can't be empty.
* Language codes must be non-empty strings.
* Values must be strings.

I'm intentionally not adding more validation for the language
codes, as this needs discussion (what values should be allowed?),
and can potentially break existing pages.

Same for empty strings. This can easily happen when users
manually create a <templatedata> tag and copy-paste pieces that
are meant to be filled in later. Empty strings are not really
invalid (again, this needs discussion), but might be something a
client want's to ignore.

Change-Id: I0facaa08cffe5a5a038423a58d55bc90a40b2d75
2020-08-19 15:29:55 +02:00