Commit graph

6 commits

Author SHA1 Message Date
Ed Sanders 7ab0c69f39 Remove support for data-mw-comment
Can be merged once I85ee8e6ed6 has been deployed long enough
for all the caches to have been purged.

Change-Id: Ic9773c2e45a4aa796cb6bca52e58d7db1016a977
2022-11-30 18:31:02 +00:00
Ed Sanders a00131a18f Embed pageThread JSON in jsConfigVars instead of infusing HTML
Bug: T322651
Depends-On: I86d461756398780dc24949013f35b7730a481052
Change-Id: I85ee8e6ed6eba97b94f4e4c415fbc5286c234cce
2022-11-08 16:20:39 +00:00
David Lynch 9ee2301f1e ThreadItemSet.newFromAnnotatedNodes needs to wait to compute names
Computing the name, for headings, requires determining the oldest
comment. This must not be done before all the replies are added to the
thread.

Follow-up to e24550fae9. It was
already *technically* incorrect before then because it was generating
the name based on the first comment in the thread, but that was only
not the oldest in very unusual cases so it was fine. That commit caused
the thread summary to be cached when first requested, however, which
made future requests for oldest/newest comment and authors to be
incorrect.

Bug: T318057
Change-Id: If0bd6caf88e72cd3f91e7f0633c40b445f5e2246
2022-09-19 14:13:51 -05:00
Bartosz Dziewoński cfa45a5f4c Remove all stuff about legacy IDs
We can no longer change IDs so easily, because they're stored in the
permalink database, so remove this mechanism to make sure it's not
accidentally used in the future.

Change-Id: I392ee1f49c48fc2f23d05e9a37c643438b4f2b9a
2022-08-24 01:01:09 +02:00
Bartosz Dziewoński a0750129e7 Set rootNode for items from in ThreadItemSet#newFromAnnotatedNodes
It's needed for the fix for T303396 to work correctly (in the case
where there's exactly 1 thread item on the page), and for the
highlight improvements in Iadbf83e02801fd9bd6336c84015994ee2819ce51.

Change-Id: I2b2f5535ebbf792910133622a271ac1491c74de6
2022-06-20 19:03:09 +02:00
Bartosz Dziewoński 8e44b43df0 Split off ThreadItemSet from CommentParser
Goal:
-----
Finishing the work from Iadb7757debe000025e52770ca51ebcf24ca8ee66
by changing CommentParser::parse() to return a data object, instead of
the whole parser.

Changes:
--------
ThreadItemSet.php:
ThreadItemSet.js:
* New data class to access the results of parsing a discussion. Most
  methods and properties are moved from CommentParser with no changes.

CommentParser.php:
Parser.js:
* parse() returns a new ThreadItemSet.
* Remove methods moved to ThreadItemSet.
* Placeholder headings are generated slightly differently, as we process
  things in a different order.
* Grouping threads and computing IDs/names is no longer lazy. We always
  needed IDs/names anyway.
* computeId() explicitly uses a ThreadItemSet to check the existing IDs
  when de-duplicating.

controller.js:
* Move the code for turning some nodes annotated by CommentFormatter
  into a ThreadItemSet (previously a Parser) from controller#init to
  ThreadItemSet.static.newFromAnnotatedNodes, and rewrite it to handle
  assigning parents/replies and recalculating legacy IDs more nicely.
* mw.dt.pageThreads is now a ThreadItemSet.

Change-Id: I49bfe019aa460651447fd383f73eafa9d7180a92
2022-02-21 16:22:32 +00:00