Commit graph

10 commits

Author SHA1 Message Date
DannyS712
18d732811d ApiQueryInfo: add associatedpage prop
Returns the prefixed title for the associated page,
if it could exist (i.e. does not do anything for special pages)

Bug: T257014
Change-Id: I49cdc138c6182b323c4933e90dc96c5e06b6ccba
2021-07-09 19:48:20 +00:00
Roman Stolar
67cc77312f Update DatabaseBlock construct option 'by' and 'byText' usage to use User Identity only
Bug: T283641
Change-Id: Ic6d4a6e10bda0115c87a85d8a9ddfd4098cd1373
2021-06-02 17:01:32 +03:00
Cindy Cicalese
b242d49a62 Use WatchlistManager in API classes
Change-Id: I7b2016162e86b455c0102742751981c44d7e829c
2021-04-21 04:41:06 +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
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
Umherirrender
a4340532e9 Set tablesUsed to watchlist for some api tests
This avoids leaking watchlist data between the test runs

Change-Id: I5b04849af0b001c5c114fde74c39e46423fe2280
2021-02-06 19:53:58 +01:00
daniel
68968305e3 Fix undefined index error in ApiQueryInfo
The code didn't properly handle requests for info about non-existing
pages.

Bug: T271804
Bug: T271815
Change-Id: If4e56ff5ecb4a048767833c89847bb58269cad43
2021-01-12 15:29:52 +00:00
MusikAnimal
21d6f1cd6a ApiQueryInfo: Return watchlist expiry when applicable for inprop=watched
The expiry is returned as a separate key, 'watchlistexpiry', to match
other APIs, and because some clients might expect 'watched' to be a
boolean (or blank string depending on the formatversion).

Bug: T268834
Change-Id: I227d6ed42e70ba1ddec0139e8198f536dfba0b46
2021-01-06 13:51:27 -05:00
C. Scott Ananian
f9433de05e api: Use GetLinkColours hook to export CSS classes in page info
Several important extensions (Disambiguator, ProofreadPage, and
SoftRedirector) use the GetLinkColours hook to add additional CSS
classes to links on article pages. Parsoid previously relied on
backdoor knowledge of the way Disambiguator used the page property
table to support these, but they should be exported properly from the
API.

Bug: T237538
Change-Id: I945940aa872541d7e01f1e543ca854231c857fe2
2020-12-14 17:51:50 -05:00
Aaron Schulz
815912062f Move ApiQuery* tests under the /query subdirectory
Consistency aside, this is useful for grouping more tests
into separate threads when using directory based suites.

Bug: T50217
Change-Id: Ife9acd5990c4ae4a5fc18371559e93d7d86fb57d
2020-10-30 03:31:12 +00:00
Renamed from tests/phpunit/includes/api/ApiQueryInfoTest.php (Browse further)