Commit graph

36 commits

Author SHA1 Message Date
Ed Sanders
c7926a58d6 api-testing: Fix variable scopes to avoid shadowing
Change-Id: I3ba5e9bd98c0e66c7e4050ca5c9f0320042149d7
2020-06-24 13:21:36 +01:00
Ed Sanders
08510de602 api-testing: Use wikimedia/mocha eslint config
Change-Id: Iec346d87f252c66fbff1e0fa522d7440df6f1764
2020-06-18 19:20:33 +01:00
jenkins-bot
2d34500f59 Merge "UserContributions endpoint: filter suppressed revisions" 2020-06-16 18:33:33 +00:00
jenkins-bot
94a0cdec43 Merge "REST api: bump some endpoints to v1" 2020-06-16 16:36:21 +00:00
daniel
96aacab20b UserContributions endpoint: filter suppressed revisions
ContributionsLookup needs to have the acting user (the authority) passde
in explicitly, so suppressed user contributions can be filtered according
to the user's permissions.

Bug: T252202
Change-Id: I94098f87ae45cd4e1db4a7168bf6e9478e9e32fc
2020-06-16 08:20:32 -07:00
daniel
5601152836 REST /me/contributions: implement backwards paging
This is part of a chain of patches that implement the user
contributions endpoint. This patch adds the ability to navigate
towards newer newer contributions from a response listign older
contributions.

Bug: T252202
Change-Id: I54c43f3c7bd5d2fa55431eda733291a7067bfc75
2020-06-15 11:41:36 -07:00
Nikki Nikkhoui
fbe321166e REST /me/contributions: allow paging forward
This is part of a chain of patches that implement the
user contributions endpoint.

In this patch, we add the ability to page through changes,
from latest to oldest only.

Bug: T252202
Change-Id: If1e862e419ce86b68606ddf28a78304461d3a6d8
2020-06-12 13:50:16 +02:00
daniel
2f3e07a6c9 REST api: bump some endpoints to v1
The following endpoints move from v0 to v1:

  GET page/{title}/links/language
  GET page/{title}
  PUT page/{title}
  POST page
  GET page/{title}/bare
  GET page/{title}/html
  GET page/{title}/with_html
  GET page/{title}/links/media
  GET file/{title}

NOTE: after merging this, give SRE a heads up, e.g. by
putting a note on the train ticket when this is merged
(navigate from T254174 as appropriate). 

Bug: T255043
Change-Id: I3b8890da901e6312582d9a215c6a647173f16149
2020-06-11 20:16:47 +00:00
daniel
5ac84ffd12 REST /me/contributions: return revisions
This is part of a chain of patches to complete the REST User Contributions
endpoint. This change returns a list of the 2 (hard-coded for now) most
recent revisions for a given user.

Package.json was also updated for new api-testing module (v 1.1.0)

Bug: T252202
Change-Id: I42a5dfc0e1ff7600848e89ac2c4b002e8a3612df
2020-06-09 08:19:45 -07:00
Nikki Nikkhoui
300fcfd00b REST me/contributions: Returns 401 Unauthorized
This is the first in a chain of patches that iteratively create
the me/contributions endpoint that returns a list
of contributions by the currently logged in user.

This patch contains stubs for major classes needed
as well as implementation and test just for returning
a 401 Unauthorized for anonymous users.

Bug:T252202
Change-Id: Ib75711bb015f476e9d486cb3008eb7b06b148d00
2020-06-09 15:00:25 +00:00
jenkins-bot
12e424bb78 Merge "Move final batch of tests from api-testing to core" 2020-06-08 19:37:11 +00:00
daniel
2051b84e5f PageHistoryHandler: fix self-reference route
THis introduces Handler::getRouteUrl() and uses it in
PageHistoryHandler() to generate self-reference links to adjacent
segments of the response.

Bug: T252566
Change-Id: Ie7b2c6cc63c8a499d4714336b917a9e3328294ca
2020-06-08 18:56:26 +02:00
Clara Andrew-Wani
daf10105a8 Move final batch of tests from api-testing to core
Moving tests that were added to api-testing repo after the initial
move to core.

Tests are from:
* Ifdfc56a80e70f169fa857af4123041723463cf90
* I55f9b23805f4c10449a508633f36c0bb75b06717
* I04db44c89a7b0bcb6dabb2ab9d9d96d495d98e82
* I3b74a9fb2f318158a72856599db837f63426ae4d

Change-Id: I83fc653f1a2f44cc12a5452cd659e809e6332b37
2020-06-05 11:28:52 -04:00
Ed Sanders
8b720e9bd6 eslint: Update to eslint-config-wikimedia 0.16.0
* valid-jsdoc replaced with jsdoc plugin
* New /selenium config

Change-Id: I471eebac0312cb25c539c3f6a3ecfc7cfd4ed8d6
2020-06-02 21:32:56 +01:00
jenkins-bot
f11aee48da Merge "CreationHandler: fix redirect URL" 2020-05-26 19:07:43 +00:00
daniel
504e9c446f CreationHandler: fix redirect URL
Add missing version prefix to Location header emitted after successful
creation.

Bug: T253143
Change-Id: I6262f61668cefacce12ed6f2a976340e10cf105b
2020-05-25 11:13:18 +02:00
Nikki Nikkhoui
eeac328472 Move Search endpoints into core routes
Move both search endpoints from coreDevelopmentRoutes to coreRoutes, making them
accessible in a production environment.

Change-Id: I14c1a9eb4c76a22f72caa7ae201699d4ef9eb282
2020-05-20 11:52:47 -07:00
Ed Sanders
d94f90e088 eslint: Code style fixes for upcoming config change
Change-Id: Ief44c0bb26c5a1c1773cab5dba51d5e856612bf7
2020-05-14 22:19:55 +01:00
Peter Ovchyn
7df7b923da rest: Add 'thumbnail' and 'description' fields to the search response
By default, core adds those fields as null to each row.
provideThumbnail and provideDescription hooks are introduced.
Extension should subscribe on the hooks to provide a thumbnail and description respectively.

Bug: T250144
Change-Id: I42c6c8ff9d887a440174af2a21c7921573b06640
2020-05-05 19:35:52 +03:00
jenkins-bot
f98a9e576a Merge "SearchHandler: emit Cache-Control header." 2020-04-06 15:53:50 +00:00
daniel
7d8fe94ea2 SearchHandler: emit Cache-Control header.
Completion search used for type-ahead should make use of http caches,
like ApiOpenSearch does.

Bug: T245675
Change-Id: Ia8366684203381b6c4dc55669a6877e53e9ffe40
2020-04-06 13:37:49 +02:00
jenkins-bot
83fc4e8c11 Merge "SearchHandler: add support for completion search" 2020-03-27 15:55:48 +00:00
daniel
76b703fe5c SearchHandler: add support for completion search
This defines a new REST route, /coredev/v0/search/title

Bug: T246387
Change-Id: Ib8d64f3028d3fa2ce239f922181064a3fc91a488
2020-03-26 20:38:30 +01:00
jenkins-bot
fde16090b6 Merge "REST endpoints: Add etag and last-modified headers" 2020-03-26 03:15:58 +00:00
jenkins-bot
6d791abd80 Merge "Define POST handler for /page/: create page" 2020-03-26 01:33:50 +00:00
daniel
22561b64a7 REST endpoints: Add etag and last-modified headers
Modified endpoints:
* /v1/page/{title}/history
* /v1/revision/{id}/bare
* /coredev/v0/page/{title}/links/language
* /coredev/v0/page/{title}/links/media
* /coredev/v0/file/{title}

Bug: T238374
Change-Id: I3ddf8fafc17eba3aec724a445d38af98bbc74dc1
2020-03-26 00:18:34 +01:00
daniel
c4382301cc REST Handlers: use max-age not maxage for cache-control
Smally typo, big consequence.

Change-Id: I1d8f43dd3b11e4854b08d41fb5f0c7ede3dba90e
2020-03-25 22:38:03 +01:00
daniel
65342f8353 Define POST handler for /page/: create page
NOTE: once this is merged, also merge Ie7b47e6868cc on the OAuth repo,
to fix unit tests after a breaking change to Router's constructor
signature.

Bug: T230842
Change-Id: I8f5b92918a58e44a4f2d8c78d234d9f64c2d06bf
2020-03-25 20:49:20 +01:00
daniel
81a47eaad3 page/update: return diffs on conflict
This adds diffs for use in an interactive merge when detecting an edit
conflict.

Bug: T230843
Change-Id: I6345361fce98524027ad778749d4fbf54169ccb6
2020-03-23 15:59:47 +00:00
daniel
58e5332991 page/update endpoint
Bug: T230843
Change-Id: I95289eddfc9ab2e0cef11b9363a5e239cdb2258e
2020-03-23 16:59:21 +01:00
daniel
c647e16c92 SearchHandler: implement limit parameter
The integration tests in Search.js were copied from the api-testing repo, see
<https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/tools/api-testing/+/refs/heads/master/test/REST/Search.js>

Bug: T245676
Change-Id: Icb4e9b363586914f2c4bcf809bde003d90c017db
2020-03-04 11:13:55 +01:00
Clara Andrew-Wani
aa0ad28c4f Move Search and Watchlist tests from api-testing repo into Core
Bug: T236680
Change-Id: Id1e37791576d27e5e7007387e91270392e7d5904
2020-02-06 00:55:53 +00:00
Clara Andrew-Wani
f07d7ba699 Move tests from api-testing repo into Core
Except for Search & Watchlist, which need fixes in gated extensions first.

Change-Id: I88d24dda4bc047868de3ff9dd4a5753b9c7b0f64
2020-02-05 16:07:54 -08:00
Petr Pchelko
a136005a35 REST: /page/{title}/{bare,html,with_html} endpoints backed by RESTBase.
Bug: T234377
Bug: T234375
Change-Id: I77709c17e951e3efb542028e5c0d53eedda8c7bf
2020-01-23 11:55:20 -08:00
Nikki Nikkhoui
6fc42ade9d PageSourceHandler integration tests
Add integration tests for /page/{title} endpoint
Bug: T229663

Change-Id: If8e140f70c518a8fa5e5eaef46f87a383c813e40
2020-01-14 16:43:43 -08:00
Clara Andrew-Wani
ac4dec907b Add API-testing to core
Bug: T236680
Depends-On: I0110de1539e4d6d9d6a58d1a645c1a1c02d8127f
Change-Id: I827dc895719cc68738ebb425f8471ac38caa49aa
2019-12-19 13:20:12 -05:00