Commit graph

2042 commits

Author SHA1 Message Date
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
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