Page MenuHomePhabricator

Page preview does not reflect published state
Closed, ResolvedPublic

Description

This task involves the work with ensuring the version of talk pages people see when they preview the changes they've made with non-DiscussionTools interfaces to talk pages matches the talk page they see when publishing the changes they've made.

Behavior

  1. On desktop or mobile, visit a talk page on a wiki where Topic Containers are enabled. E.g. https://patchdemo.wmflabs.org/wikis/916be355b2/w/index.php?title=Talk:Frances_Perkins4 .
  2. Open the source editor
  3. Make some changes
  4. Preview the changes you made in "Step 3."

Actual

  1. ❗️The preview appears as it does were Topic Containers NOT enabled (note the section headings and lack of metadata):
Desktop previewMobile preview
Screen Shot 2022-05-27 at 5.24.15 PM.png (1×1 px, 242 KB)
IMG_DD8AE19D7499-1.jpeg (2×1 px, 696 KB)

Expected

  1. ✅ The preview appears as it does were Topic Containers enabled. More details in ===Requirements below.

Requirements

  • Editing Interface(s) (platforms): 2010 wikitext editor and 2017 wikitext editor (mobile & desktop)
  • Preview method(s): existing "asynchronous" preview, real-time preview, live preview
    • Preview Contents
      • Show: Topic Container section title styling as it will appear on published page, discussion metadata (number of comments, number of people in discussion, time of last comment [1])
      • Do NOT show: interactive page components (read: Subscribe buttons/links, Reply buttons/links, empty state message, section [ edit ] links (already done))
  • Editing Interface(s) (platforms): New Topic Tool (mobile & desktop)
    • Preview Contents
      • Show: Topic Container discussion title styled as it will appear on published page, discussion "body" / "subject" styled as it will appear on published page
      • Do NOT show: interactive discussion components (read: Subscribe buttons/links, Reply buttons/links, empty state message, section [ edit ] links (already done))
      • Do NOT show: discussion metadata (number of comments, number of people in discussion, time of last comment

1. Metadata shown in the preview should reflect the state of the discussion at the moment people click the necessary button to show the preview.

Open questions

  • How – if at all – should metadata be presented within the preview?
    • Per today's team discussion, and the newly-created ===Requirements section above, metadata will be presented within the preview

Done

  • Answers to all ===Open questions are documented
  • Expected behavior is implemented

Event Timeline

matmarex moved this task from Incoming to Doing on the Editing-team (Kanban Board) board.
matmarex subscribed.

Seems straightforward

Change 802212 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/DiscussionTools@master] Enable transformations in preview mode

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

Some more work is needed to make this work with visual enhancements. Demo here: https://patchdemo.wmflabs.org/wikis/1e0bfedadd/wiki/Talk:Main_Page

  • Doesn't work in normal wikitext preview, needs to be allowed in HookUtils::isFeatureEnabledForOutput
  • Possibly unexpected in new topic preview?

image.png (2×3 px, 226 KB)

image.png (2×3 px, 224 KB)

  • Possibly unexpected in new topic preview?

Good catch, @matmarex. Yes, metadata appearing within the preview that appears beneath the New Topic Tool's source mode is unexpected to me.

You surfacing this was the reminder I needed to account for the New Topic Tool in the task description's newly-created ===Requirements section. Do you see anything unexpected about what I'm proposing?

  • Preview method(s): existing "asynchronous" preview + soon-to-be introduced real-time preview

I don’t know whether you intentionally left it out, but I want to make sure that you’re aware of a third preview method: the so-called “live preview” (tracking task: T41272), which takes over the traditional (full-page-reload, “asynchronous”) preview. It doesn’t update automatically (unlike the soon-to-be-introduced real-time preview), but it’s almost as fast as it. Actually, as far as I see, the “real-time preview” uses the “live preview” under the hood, so if the topic containers appear in the “real-time preview”, they’ll probably appear in “live preview” as well, but it may be worth being QAd separately, just to make sure.

Indeed, they use the same "backend" and should work the same. I noted it for QA.

Esanders subscribed.

Looks like there are some open design/UX questions.

Looks like there are some open design/UX questions.

@Esanders what open questions are you seeing?

...I'm not seeing any open questions in Gerrit or the task description, tho I could be missing something.

Looks like there are some open design/UX questions.

@Esanders what open questions are you seeing?

As discussed during today's team meeting, we are going to rebase the patch that will resolve this ticket so that it can be deployed independent of other Usability Improvement features (T304371 and T304372).

With the above in mind, no open questions remain at this time.

Change 802212 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] Enable transformations in preview mode

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

I checked the behavior for the following conditions:

  1. Editing interface 2010 wikitext editor on desktop with existing "asynchronous" preview.
  2. Editing interface 2010 wikitext editor on desktop with real-time preview.
  3. Editing interface 2010 wikitext editor on desktop with live preview.
  4. Editing interface 2017 wikitext editor on desktop with existing "asynchronous" preview.
  5. Editing interface 2017 wikitext editor on desktop with real-time preview.
  6. Editing interface 2017 wikitext editor on desktop with live preview.
  7. New Topic Tool on desktop with built in preview.
  8. Editing interface MobileFrontend wikitext editor on mobile with the preview mode available there.

In all cases, I am observing the expected behavior being correctly implemented as specified under the "Requirements" section. I didn't see any preview section for the new topic tool on mobile so I couldn't cover testing that scenario.

However I noticed that, with both 2010 and 2017 wikitext editor, clicking on the the latest comment link on the preview page produces the following error regardless of the preview methods:

Uncaught TypeError: Cannot read properties of null (reading 'getNativeRange')
    at load.php
    at Array.forEach (<anonymous>)
    at new Highlight (load.php))
    at Object.highlightTargetComment (load.php)
    at load.php

Also, when you click on that link, it jumps to the latest comment but the highlight is missing.

Change 816193 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/DiscussionTools@master] highlighter: Fix exception when trying to highlight an unknown comment

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

Change 816194 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/DiscussionTools@master] Initialize on live preview and real-time preview too

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

Thanks @Ryasmeen, these patches should resolve these two issues (the exception and the missing highlight).

While testing this, I also noticed that there are some weird things happening if you have the real-time preview open (the new beta feature), and use the live preview (the old preference), resulting in two previews being visible. Highlighting may not work, and clicking a link in one preview may jump to the other. I think this is a bug with those features and unfixable from our side if they generate two copies of elements that should only appear once.

Change 816193 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] highlighter: Fix exception when trying to highlight an unknown comment

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

Thanks @matmarex. I just checked the fix. The exception is not occurring anymore. However, while it seems the highlight is now appearing for the async preview mode, it's still missing for the Live preview and Realtime preview even when they are enabled separately. Is the fix for that also something out of scope for us?

We haven't merged one of the patches yet, sorry! I didn't notice the tag was still here.

Added a note that the empty state "Start a discussion…" message will also be hidden in previews. This was already the case, but let's make it explicit. The requirements here didn't consider it, but it has a big call-to-action button to start a discussion, so it seems like an interactive element to me.

Change 816194 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] Initialize on live preview and real-time preview too

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