Commit graph

2328 commits

Author SHA1 Message Date
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
Thiemo Kreuz 62ac9da173 Use more canonical (object)[] instead of new stdClass
Both styles create the exact same object. Casting an array to an
object creates an stdClass object as well. The main benefit of this
syntax is that there is much less repetition. Everything is one
token instead of individual lines, where each line might contain a
typo.

Change-Id: I8fb09e9d33e5a1d91d4b32a71f658b31c629987b
2020-08-19 14:23:29 +02:00
Thiemo Kreuz 7fd1367918 Remove obsolete return true and & from hook handlers
In detail:
* Don't pass the Parser by reference. Hook handlers don't need to
  replace the object with another one, and shouldn't.
* Use __CLASS__ instead of repeating the class name.
* Returning true from a hook is meaningless and indistinguishable
  from the default.

Change-Id: Iac60f7f4946eb78cfb3b579fcdb1cab8bdcac7cd
2020-08-19 14:14:35 +02:00
Thiemo Kreuz 4a0d7139ca Remove unused variables
Change-Id: I3f307113be730d770af796e91bc28bb149c45ad5
2020-08-19 14:11:02 +02:00
Translation updater bot 1c91be000e Localisation updates from https://translatewiki.net.
Change-Id: I17a2c7b3a59a6e1928c38e464fa252487eddd4c9
2020-08-19 08:39:45 +02:00
Translation updater bot e415d623f6 Localisation updates from https://translatewiki.net.
Change-Id: Id8964ef24c6f248d92f84b14bb5799e424efe047
2020-08-18 08:37:51 +02:00
Siddharth VP 512911b92e Make getRawParams() ignore parameters in comments and nowiki tags
This is used by the includeMissingTitles option of API action=templatedata.
Parameter syntax existing within nowiki tags or comments will not be valid
for the template.

Bug: T237195
Change-Id: Ibbfa3e21488f2a37fc494862e929baf50607d4c9
2020-08-17 00:33:06 +00:00
Translation updater bot ae9034d1b0 Localisation updates from https://translatewiki.net.
Change-Id: Id650ec56b7955cda163be04a49932f6da1803144
2020-08-14 08:39:34 +02:00
Translation updater bot 281d7f9f26 Localisation updates from https://translatewiki.net.
Change-Id: I0c08728b8b3949581416fef18ffafa3ad1d8a8b3
2020-08-07 08:23:41 +02:00
Translation updater bot b1436601e4 Localisation updates from https://translatewiki.net.
Change-Id: I01f5e6397da7c7d5d60f502cdf74ff835d5bc902
2020-08-06 08:28:36 +02:00
Translation updater bot 997cc68ca9 Localisation updates from https://translatewiki.net.
Change-Id: I33fb24c95fc54454c428d099048555fdddcd8371
2020-08-03 08:33:45 +02:00
Ed Sanders 71b27ed1ba Set import button to display:block, fixing text overflow
Bug: T259348
Change-Id: Ibbe2ccef8062275a20200445279033e084ca12aa
2020-07-31 14:19:43 +01:00
Translation updater bot e08d6965f3 Localisation updates from https://translatewiki.net.
Change-Id: I9bb19fd1d741111ad5ef20b1f8cfe6ecf0ca1621
2020-07-30 08:36:23 +02:00
Translation updater bot 512d5ab211 Localisation updates from https://translatewiki.net.
Change-Id: I2ec7441fd9e6be5071ca4b5dd2f9c4775ea996c0
2020-07-29 08:36:13 +02:00
Translation updater bot da9000d325 Localisation updates from https://translatewiki.net.
Change-Id: Idb734e868760d85bb55af9daed25c41765356f2a
2020-07-28 08:25:14 +02:00
Translation updater bot 46accc641d Localisation updates from https://translatewiki.net.
Change-Id: Ifee2e0f038748440dbf48eb8be00099841607607
2020-07-27 08:38:34 +02:00
jenkins-bot 986ea490a2 Merge "Make the maps object editable from the TemplateData dialog" 2020-07-24 18:05:25 +00:00
adham-khatean c4ca729ed5 Make the maps object editable from the TemplateData dialog
- Enable multiline.
- Enable updating the model with user changes if user clicks "Done".
- Disable "Done" button if the user inserts invalid JSON to handle JSON errors the
user might cause, and "Done" is enabled again if the JSON is valid.
- Create "cancel" button/action which will be for maps panel only, to
discard all changes made by the user.

Bug: T257503
Change-Id: Icd495290bae0b1684f8cd53864904a35e60fffe7
2020-07-24 16:07:04 +02:00
Translation updater bot d02bf4e3df Localisation updates from https://translatewiki.net.
Change-Id: Ibd361d0dcfaa4898984f2d781ccec049813b0e7c
2020-07-23 08:28:58 +02:00
Translation updater bot 0ba5121b8f Localisation updates from https://translatewiki.net.
Change-Id: I5a570656fac2b169c8b42dc38928bc8c81ce4bf6
2020-07-22 08:27:21 +02:00
Translation updater bot 5e54a4a35a Localisation updates from https://translatewiki.net.
Change-Id: I40dd0b20837c027543696c4820371480772c1fab
2020-07-21 09:13:37 +02:00
Translation updater bot d9eab99796 Localisation updates from https://translatewiki.net.
Change-Id: I0d62c2b00c515580d066c450b392ab87ea072c91
2020-07-20 09:02:11 +02:00
Translation updater bot 2da867f213 Localisation updates from https://translatewiki.net.
Change-Id: I0d1a1819e6d8055c0167352509c5a3098407a0e0
2020-07-17 08:29:26 +02:00
Translation updater bot 3372a9cd4e Localisation updates from https://translatewiki.net.
Change-Id: I3bea867be1374e7317d0bda2777fd2d811c29da9
2020-07-16 08:21:50 +02:00
Translation updater bot 2c3d0bb89e Localisation updates from https://translatewiki.net.
Change-Id: I601121797587219f766accb9c74d4872f65bb25c
2020-07-15 09:05:01 +02:00
libraryupgrader 5225cf4da7 build: Updating lodash to 4.17.19
* https://npmjs.com/advisories/1523
* CVE-2019-10744

Change-Id: I5efc3103f96314359050d1c96353a80e0995eb12
2020-07-11 05:22:31 +00:00
Translation updater bot 02587278d6 Localisation updates from https://translatewiki.net.
Change-Id: Ic41be01dc557b2f81438212ebf6bbd321a07778f
2020-07-10 08:26:18 +02:00