Page MenuHomePhabricator

Watchlist Expiry: Implement Support for Edit Functionality (desktop view) [medium]
Closed, ResolvedPublic

Description

As a watchlist expiry user, I want to be able to watch a page via edit, so that I can temporarily watch a page after a recent edit.

Resources:

Acceptance Criteria:

  • In wikitext edit view, add the following:
    • A new label to the right of watchlist checkbox: "Watchlist time period:"
    • A drop-down to the right of label (inactive by default, before box checked)
  • When user checks the box to "Watch this page," the drop-down should become active
  • The user should be able to select watch period via drop-down
    • The drop-down has the following options:
      • Permanently (as default)
      • for 1 week
      • for 1 month
      • for 3 months
      • for 6 months
  • If the page has already been watched, the behavior should be as follows:
    • Drop-down should have days left as pre-selected option at top
    • The selection should be written as follows: "X days left" (for example, "10 days left" or "20 days left").
  • If the page has already been watched with a selected temporary time period, and the user clicks "Publish" without changing the time period selection, no changes to the watch period should be made.
  • The watch period should be saved or updated, if the user makes a new time period selection.

Visual Example:

Temporarily_watch_a_page_via_edit,_mockup_example.png (212×763 px, 59 KB)
edit page variations.png (984×760 px, 72 KB)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
ifried updated the task description. (Show Details)
ARamirez_WMF renamed this task from Watchlist Expiry: Implement Support for Edit Functionality (desktop view) to Watchlist Expiry: Implement Support for Edit Functionality (desktop view) [medium].Mar 31 2020, 11:59 PM
ARamirez_WMF moved this task from Needs Discussion to Up Next (June 3-21) on the Community-Tech board.

@Samwilson We just estimated this during Monday standup. Feel free to move this to "In Development," if you would like to work on it. Thanks!

ifried updated the task description. (Show Details)

Change 588837 had a related patch set uploaded (by Samwilson; owner: Samwilson):
[mediawiki/core@master] [WIP] Add watchlist expiry to edit form

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

The dropdown will also in some configurations appear with other form fields, such as for MediaWiki-extensions-Approved-Revs and ProofreadPage:

With default stylingManually aligned
with-flaggedrevs-and-proofreadpage.png (144×1 px, 19 KB)
with-flaggedrevs-and-proofreadpage-aligned.png (87×1 px, 18 KB)
Samwilson added a subscriber: Prtksxna.

I and @Prtksxna talked about this and decided that using flexbox for the HorizontalLayout results in the best layout and behaviour:

flexcheckboxen.png (105×1 px, 15 KB)
narrowflex.png (181×283 px, 8 KB)

This doesn't require any custom FieldLayout, but instead modifies the HorizontalLayout. This works well for narrow screens, and seems pretty robust for other extensions to add any other widget types as well.

Ready for review: https://gerrit.wikimedia.org/r/c/mediawiki/core/+/588837

Screenshot from 2020-05-18 18-53-43.png (298×794 px, 41 KB)

I can't lie... it looks pretty weird! But I guess there aren't many alternatives if we want it to play nicely with other extensions/gadgets. It's pretty easy to hack the CSS so that it's all on one line (I commented about this on the patch), and we might offer that solution to communities to put it in their Common.css if they so desire, or for individual users to add to their personal CSS. I say this since most users/wikis probably don't have anything else on that line except the single "Watch this page" checkbox.

I also wonder about the wording. "Watchlist time period: Permanently" sounds a bit odd. Shouldn't it just be "Permanent"? Further to that, I know we discussed this to death (sorry!)... but I still feel the normal "indefinite" or "infinite" might be worth reconsidering as it's consistent with other places there are expiries. The community can change the wording though, so maybe not worth fretting over. It's just a bit odd because "permanently" or even "permanent" aren't actually acceptable values, so English speakers might assume they'd work in a free-form field or the API. Of course we can always add more infinity values in ExpiryDef.php. Just a thought!

@Prtksxna and I discussed this, and we agree that the language should be changed from "Permanently" to "Permanent" in all drop-downs of this feature. This work will be done in a separate ticket (T253135), unless any engineers find it appropriate or easier to include it in existing work.

As for the drop-down below the label: I understand that it could look a bit odd. However, I understand that, in previous tests & explorations, it appeared to perhaps be the most clear to a variety of users and use cases (on various wikis). I know that Prateek is looking into this, so we can touch base with him after he discusses this with some of the designers. Thanks!

Change 588837 merged by jenkins-bot:
[mediawiki/core@master] Add watchlist expiry to edit form

https://gerrit.wikimedia.org/r/c/mediawiki/core/ /588837

Change 609611 had a related patch set uploaded (by Samwilson; owner: Samwilson):
[mediawiki/core@master] Use OOUI to toggle watchthis checkbox

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

Small thing missing (that the above patch fixes): the expiry dropdown doesn't correctly disable when the watch-this checkbox does if a user changes a page's watched status via the star while editing.

Change 609611 merged by jenkins-bot:
[mediawiki/core@master] Use OOUI to toggle watchthis checkbox

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

dom_walden subscribed.
  • In wikitext edit view, add the following:
    • A new label to the right of watchlist checkbox: "Watchlist time period:"
    • A drop-down to the right of label (inactive by default, before box checked)

Actually to the bottom, as shown in T248494#6146868.

  • When user checks the box to "Watch this page," the drop-down should become active

True.

Since T248494#6281739, toggling the state of the watchstar while editing also changes the state of the checkbox and drop-down.

  • The user should be able to select watch period via drop-down
    • The drop-down has the following options:

Yep.

I also tested in German and the translations were there.

  • If the page has already been watched, the behavior should be as follows:
    • Drop-down should have days left as pre-selected option at top
    • The selection should be written as follows: "X days left" (for example, "10 days left" or "20 days left").

This is true, it gives the same output as action=watch.

  • If the page has already been watched with a selected temporary time period, and the user clicks "Publish" without changing the time period selection, no changes to the watch period should be made.

Yep. I confirmed that the expiry date did not change in the database.

The pre-selected option which shows the current time period records the expiry date as an absolute value (e.g. "20200714085923"). So, if you unwatch a page while editing via the watchstar, you can restore your previous expiry date when you save the page by selecting this option.

  • The watch period should be saved or updated, if the user makes a new time period selection.

This is true. Confirmed this on action=watch and in the database.

I also tested that when you select a permanent time period (or unwatch the page) the expiry gets cleared from the database.

I tested the edit form with and without Javascript enabled. It looks and behaves the same in both cases (except the dropdown is always enabled without JS).

I tested that when I am previewing an edit it does not watch/unwatch the page.

I tested on a couple of different namespaces (File, Wikipedia). It watched/unwatched as appropriate (including respective Talk pages).

The change only applies to source edit. In Visual Editor it looks a bit weird. But, if you disable $wgWatchlistExpiry it returns to normal. For regression, I briefly retested using the VE interface to watch and unwatch pages, saw no problems.

I also retested source edit with $wgWatchlistExpiry disabled.

Testing environment: https://en.wikipedia.beta.wmflabs.org MediaWiki 1.35.0-alpha (703ea43) 2020-07-02T06:38:45 and 1.35.0-alpha (0679746) 2020-07-07T07:30:25.

Thank you for this thorough analysis, Dom!

I have also tested this, and I can now see the functionality on beta (see screenshot example below). For this reason, I am marking this ticket as Done.

Screen Shot 2020-07-13 at 11.31.30 AM.png (292×876 px, 45 KB)

Screenshot from 2020-05-18 18-53-43.png (298×794 px, 41 KB)

I can't lie... it looks pretty weird! But I guess there aren't many alternatives if we want it to play nicely with other extensions/gadgets. It's pretty easy to hack the CSS so that it's all on one line (I commented about this on the patch), and we might offer that solution to communities to put it in their Common.css if they so desire, or for individual users to add to their personal CSS. I say this since most users/wikis probably don't have anything else on that line except the single "Watch this page" checkbox.

I agree, we should design for the most common use cases looking the most sensible.