Commit graph

1409 commits

Author SHA1 Message Date
Ed Sanders c99e07881d Comment MonoBook fixes which are actually Apex fixes
Change-Id: I44ddc7ad4cef556b71fb3f6710d92500dfd4e9ac
2024-02-13 13:54:38 +00:00
Ed Sanders bb579ef4c6 Reduce opacity of overflow menu button
This is still an experimental feature and not deployed
anywhere, but as we mute the timestamp to indicate it
is more part of the interface than the content, we should
do the same with this overflow menu button.

Change-Id: I30391912377692fffa9e67e8c4ca63db715878bf
2024-02-09 23:53:20 +00:00
jenkins-bot 26abd2383d Merge "Fix collapsed sections when recovering autosave on mobile, take 2" 2024-02-08 16:38:22 +00:00
jenkins-bot 297f4f01dd Merge "Parser: Fix the main loop getting stuck on some signatures" 2024-02-07 22:01:56 +00:00
Bartosz Dziewoński 9db35873a4 Parser: Fix the main loop getting stuck on some signatures
In certain cases the parser could go back rather than forward after
finding a signature, causing it to find the same signature forever
until it ran out of memory.

Test cases coming later in a separate patch.

Bug: T356884
Change-Id: I8ac72b05e5e4ed45e6119c012a69708c9d8eda29
2024-02-07 22:33:57 +01:00
jenkins-bot 6816c15a03 Merge "Fix exceptions on weirdly encoded URLs" 2024-02-05 22:22:02 +00:00
jenkins-bot 4c2442eeb6 Merge "Ignore transcluded items when finding permalinks" 2024-02-05 21:46:08 +00:00
Bartosz Dziewoński 3957d7ac25 Fix collapsed sections when recovering autosave on mobile, take 2
Follow-up to 8a8c7270cf.

I think this wasn't working becase we were doing it in the wrong
order (reply tool initialization would disable toggling section
state before toggler toggled it open).

Bug: T338920
Change-Id: I7ed3d5c149ddb3d33cb67010f032c63e175687f2
2024-02-04 00:21:45 +01:00
Bartosz Dziewoński f7a8ba08fb Ignore transcluded items when finding permalinks
* Keep the information about this in the API result, which we were
  previously omitting
* Use it instead of duplicating the logic client-side

Bug: T356131
Change-Id: I7e7342e9d94a171b5ef56e646871c18c8c39c44c
2024-02-04 00:07:37 +01:00
Bartosz Dziewoński 1bb3b597ec Fix exceptions on weirdly encoded URLs
`decodeURI( fragment )` can throw if the fragment isn't correctly
encoded – e.g. when it's just '#%'.

Use mw.util.percentDecodeFragment() instead, which uses a more
resilient algorithm.

Change-Id: I8447771ad2ae33da52b71d4127981dd8a2018a7d
2024-02-03 23:48:54 +01:00
Bartosz Dziewoński d0c72f155a Fix unexpected margin on footer links in new topic tool
The new topic tool is not nested in .mw-content-ltr/-rtl,
so the rule did not apply.

Change-Id: If231170f7ab394be075d4d936b8be4c8ae97931c
2024-02-03 23:37:21 +01:00
Ed Sanders df7d101cd2 Use decodeURI for comment ID searches as well as heading searches
Bug: T356199
Change-Id: I8d366c706692caf89a2af9f11c14a9aad9422b7c
2024-02-02 17:34:26 +00:00
David Lynch 7b941aae1c Add an exception for ConvenientDiscussions-style permalinks
Bug: T349653
Change-Id: I775774084bb8abf2bc99475b426d581bed306306
2024-01-30 16:44:30 -06:00
David Lynch c4bbf8756a decodeURI fragments before sending them to discussiontoolsfindcomment
Section titles containing non-ASCII characters were being passed through
URL-encoded, resulting in no results being found.

Bug: T356199
Change-Id: Iac56ee434a37baf3d170aec992d2f2d8679b6f1f
2024-01-30 14:14:18 -06:00
Ed Sanders 8069585489 CommentParser: Ignore generated timestamp links
This will be present in parser cache output and can
sometimes be mistaken for user page links.

Bug: T356142
Change-Id: I800b23d8466f72affcadfa336aab07abf7f8d79e
2024-01-30 10:29:36 +00:00
David Lynch 87c8a26483 Require is still required to load CommentTarget
Follow-up to d647870dca.

Change-Id: I63dbedbbd156a8b1619849170eac9dc6da262ddd
2024-01-23 14:58:23 -06:00
Ed Sanders d647870dca Use ve.init.mw.targetFactory.create()
Change-Id: Ie30d813ba933e03e9c712f78eac155a41052d4b0
2024-01-23 19:42:10 +00:00
David Lynch d74eccad34 Comment-not-found toast not showing when enablePermalinksFrontend==false
results[ 0 ] would be undefined, causing a later JS error before the
toast could be shown.

Bug: T355165
Change-Id: Ia591a1e4db0acfa377201c355938a32f680393ce
2024-01-16 11:13:18 -06:00
Ed Sanders 4f217f4dab controller: Use replyWidgetPromise when opening new topic tool
This prevents an exception being thrown if you open the
new topic tool when a reply widget is still loading.

Change-Id: I17da48ddf91394d05cc82613ce5517f1e176750b
2024-01-05 16:20:30 +00:00
Ed Sanders b6ebb5db56 CommentController/ReplyWidget: Document events
Also rename CommentController#teardown to onReplyWidgetTeardown,
and NewTopicController#clear(Storage) to onReplyWidgetClear(Storage).

Change-Id: Ib1dd50ca69aac6f1836674d1a6aefa2402844c57
2024-01-05 16:20:30 +00:00
Ed Sanders 811dce7bf7 CommentController#showAndFocus: Use replyWidgetPromise
We shouldn't assume callers of this method have waited
for the replyWidget to be built.

Bug: T354292
Change-Id: Ic66b4f04b8786b07f520e329adda37efcf498dad
2024-01-05 15:26:19 +00:00
jenkins-bot 3a2e10588b Merge "Tweak CSS to deal with Parsoid's <section> tags" 2023-12-19 16:50:41 +00:00
jenkins-bot 078f57b427 Merge "ThreadItem.js: Rename getNativeRange to getRange" 2023-12-18 17:21:34 +00:00
David Lynch 95121b7364 Stop comment-not-found notification always showing when requestedSince
`TEST && false || true` is always true regardless of `TEST`, we want
`TEST && (false || true)` instead.

Bug: T353568
Change-Id: I72fa6b87f43a9d8439883dfedc35fe82974b35de
2023-12-16 09:20:19 -06:00
Ed Sanders 329a268564 ThreadItem.js: Rename getNativeRange to getRange
Makes the class more similar to PHP. The non-native
ranges exist for efficiency, but users will usually
want native ranges.

Change-Id: Ifd7dd034d2e0f3b9af050ecdab3e063df73dde5e
2023-12-15 16:22:52 +00:00
jenkins-bot 264869a561 Merge "ReplyWidgetVisual: Replace deprecated selectLastContentOffset call" 2023-12-08 23:33:00 +00:00
Ed Sanders b60be160ac ReplyWidgetVisual: Replace deprecated selectLastContentOffset call
Change-Id: I80b64ec1d3ecf1985c29a8efc3d072778ffe783f
2023-12-08 11:09:20 +00:00
Ed Sanders a853e6f3d2 Remove { passive: true } from removeEventListener
This option doesn't exist when removing an event.

Change-Id: I2449fec2b2368f829d93eea9a13c13aea1ab75f8
2023-12-08 10:59:40 +00:00
jenkins-bot d69dc24161 Merge "Ignore signatures with invalid timestamps" 2023-12-07 18:00:09 +00:00
Ed Sanders c82783a5b6 Find a heading by title in archives
* Looks for heading IDs matching "h-<heading text>-%" that once
  existed on the target page.
* For such IDs, finds where those items currently exist,
  presumably in an archive.

Pros:
* Doesn't need to know anything about the local wiki's archiving
  conventions, so can be deployed universally.

Cons:
* ID conflicts will return matches in unrelated archives, e.g.
  MassMessages.

Bug: T349653
Change-Id: Ie94efd0503e9f4689d3421babe445f9f4e2b4fb7
2023-12-06 18:39:28 +00:00
Ed Sanders 4733eb0362 Show new location of missing comments in notification
Bug: T304579
Change-Id: I5c9229a25875f0bb73c2a4dbfd0e1ac25f9c893e
2023-12-06 18:39:27 +00:00
Ed Sanders 4051c7faf4 Ignore signatures with invalid timestamps
Bug: T352455
Change-Id: Ie499db4594bfa23b618907383d0ac583849ff582
2023-12-05 13:23:15 +00:00
Ed Sanders 584dc08020 Remove file headers and @copyright tags, not used consistently in this repo
Change-Id: I3c074c7cbae52d1775b14e1e6dae22c4276b8236
2023-12-04 12:30:56 +00:00
jenkins-bot b88b4737e3 Merge "Apply slim button styles to all inline buttons" 2023-11-30 18:43:02 +00:00
Bartosz Dziewoński 978d2c54a4 Tweak CSS to deal with Parsoid's <section> tags
* The :first-child pseudo-selector to suppress top border of the first
  div.ext-discussiontools-init-section ends up suppressing top borders
  of all these divs since they are the first child of a <section> tag
  in Parsoid's HTML.

  Add `.mw-parser-output >` to these selectors, so that they don't apply
  when <section> wrappers are present in Parsoid's HTML.

* Re-implement the logic for suppressing top border with new selectors
  that work correctly with Parsoid's <section> wrappers.

  Note that one of the cases requires using the :has() selector, which
  is not supported by all browsers yet. This should not be a big deal
  in practice, as that case should be rare on Wikimedia projects.

* This can be reverted if T333031 decides to strip <section> tags
  from Parsoid's read view HTML.

Bug: T333031
Bug: T341010
Change-Id: If513c90033e9a77c8885b3b1c937e016064cc5ba
2023-11-30 18:15:35 +01:00
Bartosz Dziewoński 8271401e73 Compatibility with styles for new heading HTML
(split off from I5ab9d3373a6911c1456c30d844b66576b278a1b5)

Bug: T13555
Depends-On: I44587461582d648b56ef0c9c7ae0c322895c69c2
Change-Id: Ia32d3b3ac0de2f17401fc1a26c1fe451f273c688
2023-11-30 18:13:31 +01:00
Ed Sanders bd8793ba99 Apply slim button styles to all inline buttons
Prevents the yet-to-be-used overflow button from affecting
the line height.

Change-Id: I2f76e397f6205edd52a33a87ef1445e5752b16e2
2023-11-30 16:33:58 +00:00
Ed Sanders f2f0ec2f65 build: Update linters and fix
Change-Id: Iec16f3330f94d38bb50492b7dcc9207786b964a4
2023-11-28 16:10:47 +00:00
David Lynch 0888bf2e27 Make hiding of reply links in mw-archivedtalk !important
This was being overridden by a later rule that only affected reply
buttons on mobile.

Bug: T351542
Change-Id: Iad2f6b703827cccf46ad5909d11fe3912d7023d5
2023-11-17 09:52:46 -06:00
David Lynch 26b63503a9 Only change mobile indicator alignment when enhancements are enabled
This was causing a misalignment on mobile pages that loaded the DT
styles but didn't have visual enhancements enabled.

Bug: T351044
Change-Id: Ib5e392943331467c3d29ee2b10d3bbe4995137d0
2023-11-12 19:43:19 -06:00
David Lynch b3a838fc38 Notify when we can't find a comment from a reply-link
This requires something like an invalid timestamp, to produce a reply
link whose associated comment ID is going to not be findable.

Bug: T350633
Change-Id: Ib50c11096b9af9961b74309b60524a4b986e04aa
2023-11-07 11:59:03 -06:00
Ed Sanders e0a841fe0a Use top alignment for buttons on mobile talk pages
Bug: T344629
Change-Id: Ic81a146e57fd00f2a9d83686e91d9424c2e404bd
2023-11-03 18:58:19 +00:00
jenkins-bot ef28fbfc84 Merge "ReplyWidget: don't show the enter hint if the reply button is disabled" 2023-11-01 17:58:36 +00:00
jenkins-bot e729df2bfe Merge "ReplyWidget: don't show the enter hint if the target was in bodyWrapper" 2023-11-01 17:58:28 +00:00
jenkins-bot 048d5364e2 Merge "Replace preg_replace_callback with strtr in CommentParser" 2023-10-31 13:35:19 +00:00
thiemowmde 10dcd1f847 Replace preg_replace_callback with strtr in CommentParser
It does the same as before.

I think performance is not a concern here, and wasn't my motivation
either. But I hope this makes the code easier to read and to reason
with.

I added a pure unit test case (without involving an actual Language
object) to cover the previously uncovered digits feature.

Change-Id: I6a0fc86035817eabb42b55e58183ae094c052aa6
2023-10-31 08:55:40 +01:00
jenkins-bot bfaefe4d4b Merge "Improve performance of CommentParser::getUsernameFromLink" 2023-10-30 23:33:33 +00:00
jenkins-bot c2e2381c06 Merge "Remove obsolete check for window.history.replaceState" 2023-10-30 23:06:12 +00:00
jenkins-bot 08e219a0a4 Merge "Optimize performance of very hot code paths in CommentUtils" 2023-10-30 18:07:58 +00:00
thiemowmde 1491b47b12 Improve performance of CommentParser::getUsernameFromLink
I was curious why running the CommentParserTest takes so long. I
found this is one of the bottlenecks because it's called so often,
but many link titles that are parsed as user names turn out to be
something else. This little hack speeds up the test by 15% and has
probably a similar impact in production scenarios.

Change-Id: I5a0b3a49ba5793c8a345baaa7118fed500c082b6
2023-10-30 17:59:46 +01:00