Page MenuHomePhabricator

Changes to DiscussionTools internals to better support watching/notifications
Closed, ResolvedPublic

Description

I want to make some changes to how DiscussionTools represents discussion threads internally, to better support watching/notifications.

Treat sub-threads as part of their parent threads.

In MediaWiki, sub-sections are considered to be a part of their parent sections (for example, if you click "edit source" on Yeti#History, you'll also see the text of the sub-section Yeti#Pre-19th_century). However, in DiscussionTools we didn't do that, each thread was completely separate (for example, the thread Wikipedia:Village_pump_(technical)/Archive_182#reFill_error_reports? did not include the sub-thread Wikipedia:Village_pump_(technical)/Archive_182#reFill_appears_to_be_down_again).

I started thinking about this after seeing T261370, which would probably also require this change, but the effect on watching/notifications seems more important. If you're watching the "parent" section, you should also receive notifications for comments in any sub-sections, and also if a new sub-section is added. Currently that would be difficult to implement.

Give thread headings identifiers like comments have

For T263819, we want to allow users to receive notifications for replies to a specific thread ("Event 2"), but also replies to a specific comment ("Event 1").

If thread headings and regular comments behaved the same, it should be easier to implement this in a way that works for both cases, instead of two different ways.

Distinguish comments posted in a single edit by their parent comment, rather than sequential numbers

If someone makes multiple comments in a single edit (this is not the greatest example, since it's a voting page, but like this), we currently just "number" them and distinguish them that way. This isn't great because these numbers change when an earlier thread is archived, and the comment disappears. This could result in notifications being sent for replies to the wrong comment (and in currently existing code, can already result in reply being posted in response to the wrong comment).

It seems like it would be better to distinguish them by the parent comment's identifier. (If the comment in question is a top-level comment, then the thread heading's identifier would be used, so this kind of depends on the previous point.)

Together with the previous point, if we could treat thread headings and regular comments the same, this would also allow us to distinguish subsections with identical names, e.g. consider a voting page like https://pl.wikipedia.org/wiki/Wikipedia:Głosowania/Flagi_w_zestawieniach_medalistów#Głosowanie with several proposals and for/against sections for each one.

Event Timeline

Change 631872 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/DiscussionTools@master] Allow headings to have IDs

https://gerrit.wikimedia.org/r/631872

Change 631873 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/DiscussionTools@master] Connect sub-threads to their parent threads

https://gerrit.wikimedia.org/r/631873

Change 631874 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/DiscussionTools@master] Disambiguate comments by parent ID, rather than sequential numbers

https://gerrit.wikimedia.org/r/631874

(Let's discuss in the engineering meeting next week. I've complained about some of these before, but haven't written things down in detail until now.)

Notes from discussion:

  • Thoughts on parent IDs
    • Current approach with parent IDs being only added for duplicates is a bit of a problem, since they can still change. They should always be there, or we should have some smart system with making them optional.
    • Include parent comment’s author and timestamp in the ID
  • Thoughts on section IDs
    • MediaWiki adds numbers at the end for multiple sections with the same heading text
    • Using the ID of first comment as the section ID?
    • Ed: what if ID is the title plus smallest timestamp in the thread (i.e. date this thread was started)?
    • Ed: people reusing titles for long-term pages, e.g. “help”, “support”
    • What if someone changes a section title? (We can probably handle that in the watching system, by detecting renames)
  • Thoughts on subthreads
    • When someone replies in <h5>, how do we decide which parent section they want to watch? The desired behavior will differ between wikis and even individual pages
    • (offtopic) Having a “Watch” button for each section could be confusing; it requires the user to understand the concept of sections in MediaWiki. So picking which section to watch by default becomes more important.
    • In almost all normal discussions, <h2> headings are for threads. We worry about cases like deletion discussions, but they also usually have each section on a separate page.
    • We still need some concept of sub-sections so that watching a parent section notifies you about comments in subsections

Change 632750 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/DiscussionTools@master] Add oldest timestamp in the thread to heading IDs

https://gerrit.wikimedia.org/r/632750

Change 635617 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/DiscussionTools@master] Handle cached "legacy" IDs (and other JSON-serialized data)

https://gerrit.wikimedia.org/r/635617

Change 635668 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/DiscussionTools@master] Add legacy IDs as of wmf/1.36.0-wmf.14

https://gerrit.wikimedia.org/r/635668

Change 635617 merged by jenkins-bot:
[mediawiki/extensions/DiscussionTools@master] Handle cached "legacy" IDs (and other JSON-serialized data)

https://gerrit.wikimedia.org/r/635617

Change 631872 merged by jenkins-bot:
[mediawiki/extensions/DiscussionTools@master] Allow headings to have IDs

https://gerrit.wikimedia.org/r/631872

Change 631873 merged by jenkins-bot:
[mediawiki/extensions/DiscussionTools@master] Connect sub-threads to their parent threads

https://gerrit.wikimedia.org/r/631873

Change 631874 merged by jenkins-bot:
[mediawiki/extensions/DiscussionTools@master] Disambiguate comments by parent ID, rather than sequential numbers

https://gerrit.wikimedia.org/r/631874

Change 632750 merged by jenkins-bot:
[mediawiki/extensions/DiscussionTools@master] Add oldest timestamp in the thread to heading IDs

https://gerrit.wikimedia.org/r/632750

Change 635668 merged by jenkins-bot:
[mediawiki/extensions/DiscussionTools@master] Add legacy IDs as of wmf/1.36.0-wmf.14

https://gerrit.wikimedia.org/r/635668

We still need some concept of sub-sections so that watching a parent section notifies you about comments in subsections

@matmarex can you describe how these "define" the boundaries of a topic? E.g. Does the software consider topic to be bounded by ==H2==?

JTannerWMF subscribed.

@Esanders and @matmarex confirmed the model has the ability to identify different heading levels and the relationships between them.