Commit graph

10169 commits

Author SHA1 Message Date
Ed Sanders
070f94de80 Maintenance: Don't modify mOptions in getOption
This makes hasOption stable and usable even after getOption.

Also getOption can now be called twice with different defaults.

Strictly speaking this is a breaking change, but the actual
behaviour is now closer to the expected/documented behaviour.

Bug: T275619
Change-Id: I65e32a7e1bc253f4b29378be6980c42e43f93032
2021-02-25 15:42:05 +00:00
jenkins-bot
cbf94bdf7f Merge "Fix and add various type hints" 2021-02-24 19:20:21 +00:00
Lucas Werkmeister
293b061f29 SpecialPageFatalTest: tolerate failure to create page
Sometimes the special page can’t be created – for example, the list of
registered pages could have changed between the data provider and the
test function, due to extensions conditionally registering their special
pages. Skip the test in this case instead of crashing.

Bug: T275661
Change-Id: I573967ac22ed3a596b4f80b76d395ac948f802e8
2021-02-24 19:28:04 +01:00
jenkins-bot
b21683612a Merge "Convert skin code to Authority where ready" 2021-02-24 09:15:37 +00:00
Petr Pchelko
bb990c7e94 Convert skin code to Authority where ready
Change-Id: Ie530051d7abb3137e0e79114cb01dbb129ae0fe0
2021-02-23 21:04:19 -07:00
jenkins-bot
bcba94d420 Merge "Convert AuthManager to Authority: step 1." 2021-02-23 22:33:01 +00:00
jenkins-bot
2c3aa555d5 Merge "Use Authority in special pages pagers" 2021-02-23 22:24:17 +00:00
Petr Pchelko
eb4e26bc03 Use Authority in special pages pagers
Change-Id: I01eccaab42759c186649d69c104318e05e91157a
2021-02-23 14:29:10 -07:00
jenkins-bot
998af2a6b9 Merge "Use Authority and GroupPermissionLookup in Action API" 2021-02-23 16:03:56 +00:00
Cindy Cicalese
f6e1891c6f Use Authority and GroupPermissionLookup in Action API
Replaces calls directly to PermissionManager with calls to
the Authority object available from Context or the
GroupPermissionLookup service.

This patch does not address use of PermissionManager for
blocks.

Deprecations:
- ApiBase::checkUserRightsAny deprecated passing optional
User parameter
- ApiBase::checkTitleUserPermissions deprecated passing
LinkTarget as first parameter, takes PageIdentity instead

Bug: T271462
Bug: T271854
Change-Id: I5d7cac1c28a37e074750c46cda03283980a07fca
2021-02-23 14:31:14 +00:00
jenkins-bot
04626a940f Merge "Add converter for the Talysh language (tly)" 2021-02-23 12:45:31 +00:00
jenkins-bot
cfcb437c87 Merge "Use context Authority in Actions for permission checks" 2021-02-23 12:44:49 +00:00
jenkins-bot
5008ca185e Merge "UserQueryBuilder: abstraction for actor table queries." 2021-02-23 12:27:26 +00:00
Petr Pchelko
2ebb44eac4 Convert AuthManager to Authority: step 1.
Cut the explicit dependency on PermissionManager
and rely on the fact that User implements Authority.

There's still a few ends we need to cut before converting
the method parameters to Authority, but that can be done
in followup steps.

Bug: T273510
Change-Id: I69617e624f47944f8a383d0b28885678c1249f23
2021-02-22 15:40:37 -07:00
Petr Pchelko
4f0e8b038e Use context Authority in Actions for permission checks
Change-Id: I54ee99098a39bf28646d61689b8e6e5a5d7c3c68
2021-02-22 15:07:28 -07:00
jenkins-bot
9cd7d35500 Merge "Add a few tests for ActorStore corner cases" 2021-02-22 20:35:24 +00:00
Petr Pchelko
87a5cb4673 UserQueryBuilder: abstraction for actor table queries.
This introduces a specialized SelectQueryBuilder for
queries related to actor table. So far it's fairly basic,
but in future it is intended to grow.

This patch only introduces the new abstraction, using
it will be separated into separate patches.

Bug: T274223
Change-Id: Ibb1c58016e3956a46bfaf1a9f51f265114bb9ace
2021-02-22 11:47:07 -07:00
Cindy Cicalese
fd71596f97 Add caching to ActorStore
Bug: T273974
Depends-On: I8c18d86fe42056fbb676467a6657fd2f62e9c998
Change-Id: Iff5e3f07ac5b1192dd7a9f7f37589d8eae09a746
2021-02-22 09:25:13 -07:00
jenkins-bot
576adeba50 Merge "Rename Authority::getActor to Authority::getPerformer" 2021-02-22 15:21:18 +00:00
jenkins-bot
b81b33f54b Merge "Make ActorNormalization a proper service." 2021-02-22 15:21:10 +00:00
Petr Pchelko
375e9f0a68 Rename Authority::getActor to Authority::getPerformer
Bug: T274947
Change-Id: I8f652816af00bf9fa413ba4b1fa7ac4c27290dc2
2021-02-22 14:53:21 +00:00
daniel
0266b57963 Make ActorNormalization a proper service.
ActorNormalization needs to have separate wiring if we want to be able
to access it by name. This is needed to allow access to the service in
declarative wiring, e.g. via ObjectFactory specs.

As an aside, this changes SpecialPageFatalTest to not construct special
pages in a data provider. Accessing services in data providers should be
avoided. This change does not eliminate all such access, but reduces it
by deferring service lookups via ObjectFactory.

Change-Id: I5792cdcc0e5b0d1681f55dbe3e1f70c34a0cb775
2021-02-22 11:58:46 +01:00
jenkins-bot
3738b26c4f Merge "Don't accept empty option group names for dropdown elements" 2021-02-19 20:25:34 +00:00
Thiemo Kreuz
47171f7b94 Don't accept empty option group names for dropdown elements
When this code parses a string that looks like this:

*
** A
** B

It creates an option group with 2 options, but the name
of the group is an empty string. This makes the OOUI
DropdownInputWidget fail later.

Since the empty group name is useless anyway, drop it. This
makes the code behave as if the parsed string looked like
this:

* A
* B

Live example for the issue:
https://el.wikipedia.org/wiki/MediaWiki:Protect-dropdown

Bug: T275125
Change-Id: I780c1be27740b0ed3b35aa569b5a528112d7238f
2021-02-19 17:04:35 +01:00
Thiemo Kreuz
f272cc1935 Fix typo in ParserTestTopLevelSuite
Change-Id: I7384e010a0602967a21c6590e2f2bfd884c61b1b
2021-02-19 15:51:50 +01:00
James D. Forrester
5a622b6a2e build: Upgrade eslint-config-wikimedia from 0.17.0 to 0.18.1
Change-Id: I5e3687be2b197134578126e1b890ee37dbc1bc1b
2021-02-18 08:39:09 -08:00
jenkins-bot
b8e7da5aa4 Merge "Don't apply French spacing in raw text elements" 2021-02-18 16:14:50 +00:00
jenkins-bot
9532562859 Merge "DerivedPageDataUpdater: Skip all data updates when page is deleted" 2021-02-18 11:38:43 +00:00
jenkins-bot
b5bec69f6e Merge "Add mock for numParams to MediaWikiTestCaseTrait" 2021-02-17 22:37:07 +00:00
Umherirrender
ef7fc91327 DerivedPageDataUpdater: Skip all data updates when page is deleted
There is nothing the updates can do,
LinksUpdate also fails if there is no id for the given title on master

Bug: T271356
Change-Id: I7fb690bec8dbfadf71eb9caacb4edbfe6b785e73
2021-02-17 22:54:08 +01:00
Maggie Epps
7466d08aa1 Add mock for numParams to MediaWikiTestCaseTrait
Change-Id: I774b68d74e2fb89e7d8cbfd42b7588ec4c856176
2021-02-17 16:29:48 -05:00
jenkins-bot
14bf85d424 Merge "Hard-deprecate IDatabase parameter for UserIdentity:getActorId()" 2021-02-17 19:41:12 +00:00
Cindy Cicalese
2d302a936e Hard-deprecate IDatabase parameter for UserIdentity:getActorId()
Bug: T273576
Change-Id: I0df4a2749afae74671dc4c49bac4e18309677703
2021-02-17 12:51:02 -05:00
Vadim Kovalenko
66573bec7e Introduce LogEntry::getPerformerIdentity and deprecate ::getPerformer
Bug: T274329
Change-Id: I3dadb20f076494f7b46f0647ea3a8bfbbdaa59da
2021-02-17 19:12:22 +02:00
Amir Aharoni
14d363c29f Add converter for the Talysh language (tly)
Mostly copied from UzConverter.

This is a very simple converter, with bidirectional one to one
correspondence: for every Latin letter there is a corresponding
Cyrillic letter and vice versa. There are no digraphs or punctuation
to convert.

The Latin alphabet is the primary one used for this language today,
and will probably remain so for the foreseeable future, so "tly" remains
the usual code, and "tly-cyrl" is added for Cyrillic.

Language name is changed:
* The main language name is now Latin.
* The word "language" ("зывон") is removed.
* The spelling of the word "Talysh" is based on the Pireyko dictionary.

Bug: T258975
Change-Id: I552e07967ea82e03c413a0b10b129a846aa007c7
2021-02-17 13:49:36 +00:00
Petr Pchelko
49220ff4ab Add a few tests for ActorStore corner cases
Change-Id: Iba6c5d8fa15952cfef689f8f151f262aaff46417
2021-02-16 22:52:47 -06:00
jenkins-bot
4d17fffb50 Merge "Pass linkable user name in Special:Preferences "Account data" help text" 2021-02-17 01:43:48 +00:00
Thalia
208e828a1f Pass linkable user name in Special:Preferences "Account data" help text
For the optional message in the "Account data" section, introduced in
d4357d621f.

Passes the user name escaped with underscores, so that links can be
built correctly in the message translation.

This means we have to expand yet further the list of User methods called
in ApiOptionsTest, but so be it.

Bug: T272412
Change-Id: Ia1c135144763db9e92f1b555f009229bd1a9d3c8
2021-02-16 16:53:37 -08:00
Arlo Breault
c44a3958a3 Don't apply French spacing in raw text elements
This also means we don't need to take special care for French spacing in
attributes, since it's no longer applied there.

Adds a test that captures this change.

Note that the test "Nowiki and french spacing" wonders whether this
escaping should be applied to nowiki content.

Bug: T255007
Change-Id: Ic8965e81882d7cf024bdced437f684064a30ac86
2021-02-16 19:26:29 -05:00
jenkins-bot
7f11f7a59f Merge "resourceloader: Add internal handling for debug=2" 2021-02-16 19:54:10 +00:00
Thiemo Kreuz
c09f4fd6ef Fix and add various type hints
I keep fixing type hints in my local dev environment whenever I
see something that is worth updating. This is what I collected
over the past weeks.

Change-Id: Ia4f1b4bee2019abe4ab0fb0df8164e1b446229e7
2021-02-16 17:22:15 +00:00
jenkins-bot
aa28334b9c Merge "Turn CommentStore::$tempTables into a constant" 2021-02-16 16:57:19 +00:00
jenkins-bot
5d66187122 Merge "Make WikiPage a (non-proper) PageIdentity" 2021-02-16 15:51:49 +00:00
Thiemo Kreuz
91f8f7eb7e Turn CommentStore::$tempTables into a constant
It's private, and no code writes to this array. It is a
constant, just not implemented as one.

Change-Id: Ida13ce8ccc99802a8c673e06411955e5c74a417f
2021-02-16 09:42:30 +01:00
jenkins-bot
183d83b572 Merge "parser: new BeforeParserFetchTemplateRevisionRecord hook" 2021-02-16 04:31:16 +00:00
jenkins-bot
5ea464b234 Merge "Use static closures where safe to use" 2021-02-14 23:05:48 +00:00
jenkins-bot
576617d283 Merge "Use ?? instead of isset/array_key_exists where possible" 2021-02-13 17:17:28 +00:00
jenkins-bot
384a302193 Merge "Tighten invalid timestamp error checking" 2021-02-13 06:15:11 +00:00
Timo Tijhof
8fca24fdc1 API: Fix flaky ApiQueryInfoTest case
The timestamp in the year 3030 was presumably chosen so as to
always be in the future (since expiry in the past would be ignored).
However, while seemingly clever, this backfires because it gets
shrunk by the default wgWatchlistExpiryMaxDuration value to some
time in August 2021, around the "current" time of day.

And "current" generally is thought of as moving forward at a rate
of 1s/s, bending of spacetime notwithstanding. Thus the test would
sometimes fail in ways such as:

> 1) ApiQueryInfoTest::testExecute
> Failed asserting that two strings are identical.
> --- Expected
> +++ Actual
> @@ @@
> -'2021-08-13T01:23:19Z'
> +'2021-08-13T01:23:18Z'

Fix this by using a mock current time, paired with a suitable
max duration and expiry value.

Also fix some of the other asserted values to not be reflections
of the source code but actually explicit assertions (at least the
details that we know to be constant, given the environment ensured
by ApiTestCase and MediaWikiLangTestCase). This reduces the chances
of false positives from looking at itself too much, and also speeds
up the test a little.

Change-Id: If361aa98bef789b1f841741a7c83bcb2ac9edf05
2021-02-13 03:00:57 +00:00
jenkins-bot
c4f49e81c7 Merge "Fix error message in ExtensionJsonValidation test" 2021-02-12 21:26:26 +00:00