Commit graph

737 commits

Author SHA1 Message Date
Bartosz Dziewoński 10899af666 Fix parsing links in Parsoid documents without short URLs
Move the code so that we check for "?title=" query parameter first,
because we don't handle this right in the other code path.

Use parse_url() instead of wfParseUrl() because the latter doesn't
accept relative URLs, and we don't care about the other differences.

Bug: T261711
Depends-On: I4da952876e1c3d1a41d06b51f7e26015ff5e34d7
Change-Id: I70fac2b41befd782b0a47a4f726ae748dc0f775d
2020-09-02 23:42:37 +02:00
jenkins-bot 37e6f64503 Merge "Improve error message for edit conflict" 2020-09-02 16:07:37 +00:00
Translation updater bot 8e96131491 Localisation updates from https://translatewiki.net.
Change-Id: Ie35073d495b233a3c79061f37b352c5b48b81617
2020-09-02 09:40:19 +02:00
Bartosz Dziewoński ff05e0c0b5 Improve error message for edit conflict
Bug: T261788
Change-Id: I079517ad6e258dd23b9048f4133f18cbb087acd9
2020-09-01 22:33:25 +02:00
jenkins-bot 48336f66b3 Merge "Add integration tests using pages from ckb.wp" 2020-09-01 17:17:33 +00:00
jenkins-bot 00b4f2217a Merge "Improve and document the files in tests/data/" 2020-09-01 17:17:10 +00:00
jenkins-bot 8bf420e869 Merge "Fix parsing localised digits in PHP discussion parser" 2020-09-01 17:16:29 +00:00
jenkins-bot 7e069cdb00 Merge "Update watchlist status from API result" 2020-09-01 00:29:03 +00:00
Bartosz Dziewoński 934872a170 Add integration tests using pages from ckb.wp
This is primarily to cover the handling of localised digits,
which previously wasn't being tested, leading to T261706.

Bug: T261706
Change-Id: I9de7f01f77e767e9048c85604b559af4bca0de91
2020-09-01 01:50:33 +02:00
Bartosz Dziewoński 084f45128c Improve and document the files in tests/data/
* Remove 'wgMetaNamespace' and 'wgMetaNamespaceTalk', the same data
  exists in 'wgFormattedNamespaces'.

* Rename 'wgContentLang' to 'wgContentLanguage', to match its real
  name in JS config. MediaWiki doesn't use 'wgContentLang' anywhere,
  although the related PHP global is called $wgContLang.

* Document how I made these files, previously only mentioned in the
  commit message of e9c401e3aa.

Change-Id: I67f962812c155aedf41154e0d837e7feb5af972d
2020-09-01 01:50:33 +02:00
Bartosz Dziewoński 2d3fe47ac1 Fix parsing localised digits in PHP discussion parser
The PHP code incorrectly assumed that the digits are single-byte in
UTF-8, which is never the case (except for 0-9).

The JS code worked correctly because it uses UTF-16 strings, so the
bug would only affect non-BMP digits there. This was noted in a TODO
comment, but we overlooked it when reimplementing in PHP.

Instead of a string of 10 characters, use an array of 10
single-character strings.

Bug: T261706
Change-Id: Ic5421382474c88f003424799c53ff473d99cce92
2020-09-01 01:50:33 +02:00
Thalia 240c766768 Remove extra blank line from .gitignore file
Change-Id: I883880f4552fa90ce9166440d026d49e1da10db6
2020-08-31 15:24:56 +01:00
Ed Sanders d664e0dae4 Update watchlist status from API result
Mirrors the change made in VE in I2c844223.

Bug: T260434
Change-Id: I013e6e7b3a267de09a4e8100b98c77c22cb5b1fd
2020-08-29 20:31:58 +00:00
Bartosz Dziewoński 5e1b6b1b81 Skip past our own reply buttons when displaying reply widget
Without this, the reply widget would be inserted before the reply button,
in the middle of the paragraph.

Follow-up to e36dc8e78a.

Change-Id: I5e22a0a0b70e8da395eb23dd6ae80af70840a2e2
2020-08-29 16:24:48 +02:00
jenkins-bot dbfbffd4f3 Merge "Improve documentation of source/visual tabs/tags" 2020-08-27 19:20:48 +00:00
jenkins-bot 8726e92b38 Merge "Pass through watchlist state to response data" 2020-08-27 19:20:46 +00:00
jenkins-bot d069b1c0f9 Merge "build: Update eslint-config-wikimedia to 0.17.0" 2020-08-27 19:20:44 +00:00
Ed Sanders 3ad904e143 Improve documentation of source/visual tabs/tags
This has lead to confusion where 'visual' as been translated
as 'VisualEditor', and 'source' has been translated as 'wikitext'
(although in the latter case that may be the least confusing
translation possible for some languages).

Change-Id: Ifa7897dfb9bafd8fe240fd84afc92ba88b978944
2020-08-27 19:53:10 +01:00
Translation updater bot 228efebaea Localisation updates from https://translatewiki.net.
Change-Id: I8599fa1945fdb751ea9289c48fef2af3866deff5
2020-08-27 09:51:38 +02:00
Ed Sanders c240f281a4 Pass through watchlist state to response data
This got lost when the watchlist updating code was refactored
out into controller.js, as it assumes that 'data' (the post data)
is still available.

Bug: T261362
Change-Id: Id274e7b8518b62dddbc3d4095d9f6cab17aa17cd
2020-08-26 23:50:06 +01:00
Ed Sanders d36ffeaa3d build: Update eslint-config-wikimedia to 0.17.0
Remove variable shadowing, and fix some documentation.

Change-Id: I08a7cbbdc0a1a409f9c4415b36c62c89535e12eb
2020-08-26 23:46:34 +01:00
jenkins-bot f167bfc5b1 Merge "Don't trust RESTBase to give us the correct revision" 2020-08-26 20:27:22 +00:00
jenkins-bot ca279832cc Merge "Fix reply widget documentation" 2020-08-25 19:10:11 +00:00
jenkins-bot bc80b51fcd Merge "Fix typo in API help message key" 2020-08-25 13:28:55 +00:00
Ed Sanders d3205b877f Fix typo in API help message key
Change-Id: Idb4e973f4adb3affa857f99680707e35676810fa
2020-08-25 13:24:31 +01:00
jenkins-bot f83e2370c1 Merge "Skip to the end of the paragraph in the parser, not modifier" 2020-08-25 11:56:10 +00:00
jenkins-bot 4218d930a7 Merge "Fix error handling in controller#getPageData" 2020-08-25 11:11:39 +00:00
jenkins-bot 4be90d7494 Merge "Re-apply new reply API patches (again)" 2020-08-25 11:11:12 +00:00
Translation updater bot 44eb15f1d5 Localisation updates from https://translatewiki.net.
Change-Id: I2a2093e29a3ce5c4a22363f02faf80579e7a9946
2020-08-25 09:46:20 +02:00
Ed Sanders 17ba57edd6 Don't trust RESTBase to give us the correct revision
As we do in VE, extract the revid from the document.

Unlike in VE we don't need to throw an error if there is
a mis-match, as we will likely be able to make the edit anyway.
Just use the ID we got from the document.

Log a warning if there is ever an ID mis-match so we
can evaluate if this check is actually needed.

Change-Id: I94c37980524a9faabac49495903a5262387af562
2020-08-24 17:24:50 +01:00
Translation updater bot 4fc4286be3 Localisation updates from https://translatewiki.net.
Change-Id: Id340cda545bf9a906ef1cb8911ba7cb8e943e93e
2020-08-24 11:57:51 +02:00
Translation updater bot 711350c948 Localisation updates from https://translatewiki.net.
Change-Id: Ibd69a94b7a8fef87955564cd69c446404009e427
2020-08-21 08:40:46 +02:00
jenkins-bot e1eb983d51 Merge "parser: Code quality tweaks" 2020-08-20 20:01:03 +00:00
Bartosz Dziewoński e36dc8e78a Skip to the end of the paragraph in the parser, not modifier
When a comment ended before the end of a paragraph, the next
comment would begin right there in the middle of the paragraph.
This could result in the detected indentation level of that
comment being incorrect, and replies being inserted in wrong
places, as seen in the 'signatures-funny' test case.

The code moved to the parser was previously repeated twice in
addListItem() and addReplyLink(), which should have been a hint
that something isn't quite right.

Also, fix the code guarding against overlapping signatures,
now that signatures may not be at the end of a comment.

Bug: T260855
Change-Id: Ic26a87642f8a15d5de2f7073d4d8176b299c7f94
2020-08-20 19:35:55 +00:00
Bartosz Dziewoński 84cb9d1dca parser: Code quality tweaks
Do things in a more intuitive order, avoid some repetition,
rename a vaguely named variable.

Change-Id: Ic1a0bb54134682eaf126231e04eb67847d6a5da6
2020-08-20 20:52:42 +02:00
jenkins-bot 8dc5f0b7ba Merge "More test cases for multiple signatures in funny places" 2020-08-20 12:10:45 +00:00
jenkins-bot 5f8214a2e4 Merge "parser: Fix comment ranges when timestamp has entities" 2020-08-20 12:10:43 +00:00
Translation updater bot dddfbc99de Localisation updates from https://translatewiki.net.
Change-Id: I10af141bbea61b5c5995a6fdaeeecd7e804948eb
2020-08-20 08:26:49 +02:00
Bartosz Dziewoński 03539527b4 Fix error handling in controller#getPageData
We were accidentally resolving the promise with `undefined`, rather
than rejecting it. This later caused "TypeError: Cannot read property
'linterrors' of undefined" in controller#checkCommentOnPage.

Bug: T260294
Change-Id: I29418988023d86140cfa110c0c348059b293a716
2020-08-19 20:06:09 +00:00
Ed Sanders c32a8996c7 Fix reply widget documentation
Change-Id: I46d033595ecf6c226ae23aefb03884841a3299c7
2020-08-19 20:05:55 +00:00
Bartosz Dziewoński b706eac8bc Re-apply new reply API patches (again)
This reverts commit 4d7c98b97c.

Change-Id: I4100521efb687ec324d25e273a9c986fd5dac0d0
2020-08-19 20:05:42 +00:00
jenkins-bot 1159172e32 Merge "Fix crash when trying to mention invalid usernames" 2020-08-18 15:35:29 +00:00
jenkins-bot 470c630662 Merge "Revert new reply API (again)" 2020-08-17 20:22:58 +00:00
Translation updater bot a96dac0f8c Localisation updates from https://translatewiki.net.
Change-Id: I9ffe9aa99add61fda3ac1d5611139a830a2f0372
2020-08-17 08:42:24 +02:00
Bartosz Dziewoński e0312957e6 Fix crash when trying to mention invalid usernames
Change-Id: I1e7213c38067e3c3107752705c4d3e4ed64a9258
2020-08-16 22:50:32 +02:00
jenkins-bot b31c9ae7fb Merge "Allow the mention prefix to be configured via a message" 2020-08-16 19:17:13 +00:00
Translation updater bot b591c41c37 Localisation updates from https://translatewiki.net.
Change-Id: I86775068195c564452ad67dac669c25fbd3d0a0d
2020-08-14 08:37:42 +02:00
Bartosz Dziewoński 4d7c98b97c Revert new reply API (again)
Causes page corruption, in a new way we haven't seen before.

* Revert "Move page updating logic to controller.js"
  This reverts commit 54fdc6de06.
* Revert "ReplyWidget: Move clear methods from #teardown to #clear"
  This reverts commit 9b811a94e0.
* Revert "ApiDiscussionToolsEdit: Do not pass 'basetimestamp'"
  This reverts commit 7de5938a6f.
* Revert "Use DOMCompat::getOuterHTML instead of doc->saveHTML()"
  This reverts commit 7b2448d2f0.
* Revert "CommentController: Remove remains of client-side edit conflict handling"
  This reverts commit 2d038af705.
* Revert "Restore error message for when comment is deleted while replying"
  This reverts commit 655c0526d6.
* Revert "Use transcluded from API to avoid ever fetching Parsoid DOM in client"
  This reverts commit 9d0fc184fe.
* Revert "Create a 'transcludedfrom' API endpoint"
  This reverts commit 5d8f3b9051.
* Revert "Edit API for replies"
  This reverts commit 8829a1a412.

Bug: T259855
Change-Id: I6419408c6194ec0afa6b8ee604b12c1a24c6ac7b
2020-08-13 20:19:29 +02:00
Ed Sanders 54fdc6de06 Move page updating logic to controller.js
Change-Id: I9cd11f49a9dd7bf9c6aa034359244c3a21f459e8
2020-08-13 11:59:41 +01:00
Ed Sanders 9b811a94e0 ReplyWidget: Move clear methods from #teardown to #clear
Change-Id: Ieb02f57d31579ac9c3ee2f20f07f9107e70348d4
2020-08-13 11:11:08 +01:00