Page MenuHomePhabricator

Skin should show "Watch" (not "Unwatch") tab on action=unwatch response
Open, LowPublic3 Estimated Story Points

Description

What is the problem?

If you unwatch a page via action=unwatch, on the success page the watch star shows the previous state (i.e. full or half-shaded star). On refresh, the correct empty star shows.

This appears to be the same issue as T253937, but for action=unwatch. A similar issue was recorded in T28292.

Raised by @IKhitron on https://meta.wikimedia.org/wiki/Talk:Community_Tech/Watchlist_Expiry#Anything_else_you_would_like_to_add?_4.

Steps to reproduce problem
  1. Go to https://en.wikipedia.beta.wmflabs.org/w/index.php?title=Selenium_Echo_link_test_0.8809995352983244&action=unwatch
  2. Click the watch star (you can set a temporary or permanent watch, does not matter)
  3. Click the "Yes" button
Acceptance Criteria
  • If the user unwatches a page via action=unwatch, the star should automatically be empty (rather than displaying the previous state)

Expected behavior: You go to a success page and the watch star is empty
Observed behavior: On the success page, watch star is full/half-full

Extra Notes: If one tries to unwatch a page *not* via the AJAX star, but by direct link to e.g. /w/index.php?title=Foo&action=unwatch (and submit the confirmation form), that POST response has at the top of it a solid blue star. A refresh corrects the error.

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:19 PM
bzimport set Reference to bz26292.
bzimport added a subscriber: Unknown Object (MLST).
  • Bug 32627 has been marked as a duplicate of this bug. ***

Created attachment 10617
bug: the star should be blue after watching the page

I confirm this following these steps:

  1. [[User:Js/watchlist.js]] was not in my watchlist
  2. I went to

https://en.wikipedia.org/w/index.php?title=User:Js/watchlist.js&action=watch

  1. I answered [yes] to the question "Add this page to your watchlist?"
  2. The page was reloaded, and there was a message "The page "User:Js/watchlist.js" has been added to your watchlist...", but the star was still white (see screenshot)
  3. Reloading the page (by clicking in the "User page" link) fixed the star color.

Attached:

sumanah wrote:

I can no longer reproduce this bug, so I think that in the last 7 months something else must have fixed it. :-) Thanks for the report!

I'm still able to reproduce it following the steps from comment 3.

Yes, still can be reproduced.

  • Bug 62458 has been marked as a duplicate of this bug. ***

Seriously? This bug has been open for this long?! o_O
I'm guessing race condition... does skin render before the watch actually takes place?

I can reproduce this bug on enwiki by the steps from comment 3. But I cannot reproduce this bug on a local wiki.

I also can't replicate this at the moment.. I'm not sure what changed if anything since the 9th...

(I can still replicate this on enwiki and mediawiki.org though)

I still can reproduce this bug on enwiki by the steps from comment 3. But I cannot reproduce this bug on a local wiki.

[..] does skin render before the watch actually takes place?

Unlikely.. My guess is slave lag as it's happening on WMF wikis but never able to reproduce locally.

Since that action doesn't redirect, then the isWatched() call probably happens before the update is commit, each being read from different servers. It would need to force the new value via some method, or redirect, or have isWatched() check hasOrMadeRecentMasterChanges().

Krinkle renamed this task from ?action=unwatch page still shows solid blue ("Remove this page...") star to Skin shouldn't show "Unwatch" tab in action=unwatch response.Nov 3 2015, 7:19 AM
Krinkle updated the task description. (Show Details)
Krinkle set Security to None.
Krinkle removed a subscriber: wikibugs-l-list.

I still can reproduce this bug on enwiki by the steps from comment T28292#306400.

Can a change like https://gerrit.wikimedia.org/r/#/c/263673/2/includes/AjaxDispatcher.php fix this problem?

I still can reproduce this bug on enwiki by the steps from comment T28292#306400.

Can a change like https://gerrit.wikimedia.org/r/#/c/263673/2/includes/AjaxDispatcher.php fix this problem?

The change is not related.

I can not reproduce this bug on enwiki by the steps from comment T28292#306400. Which change fixed this bug?

I'm pretty sure this bug is still there. loadWatchedItem() does not check for recent writes. It might be more or less common at times though.

Krinkle renamed this task from Skin shouldn't show "Unwatch" tab in action=unwatch response to Skin should show "Watch" (not "Unwatch") tab on action=unwatch response.Nov 1 2016, 11:43 PM

Change 319255 had a related patch set uploaded (by Krinkle):
WatchedItemStore: Update process cache when adding items

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

Change 319255 merged by jenkins-bot:
WatchedItemStore: Update process cache when adding items

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

Change 319255 merged by jenkins-bot:
WatchedItemStore: Update process cache when adding items

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

This patch helps ensure that after adding a page to the watchlist, the confirmation page will show "Unwatch" instead of "Watch".

However, the reverse use case (removing a page from the watchlist) is not yet covered because WatchedItemStore only caches presence of values, not absence.

This breaks if the new $wgWatchlistExpiry feature flag is set. I cannot really figure out why... WatchAction ends up calling WatchedItemStore::addWatchBatchForUser() which explicitly uncaches the watched items (with cache key of user + page title), then caches again. So it should be caching the correct object state. @Krinkle I was hoping you could maybe take a look at this...? It would seem we can't use the expiry in the cache key, since we don't know what it is when we wanted to fetch the cached object.

Also T256654: pages watched using the watchthis control in the wikitext editor do not show as watched after publishing until the page is reloaded was reported yesterday, which seems to be the same underlying issue. However that I can't replicate locally, and I do not believe that is related to my team's watchlist expiry work.

ARamirez_WMF set the point value for this task to 3.Sep 17 2020, 11:29 PM
ARamirez_WMF changed the subtype of this task from "Task" to "Deadline".

Change 629916 had a related patch set uploaded (by Dmaza; owner: Dmaza):
[mediawiki/core@master] watchedlist: cache null values when unwatching

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

Change 629916 had a related patch set uploaded (by Dmaza; owner: Dmaza):
[mediawiki/core@master] watchedlist: cache null values when unwatching

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

I have a patch up and I'm looking for feedback on what I'm doing there. I've left a comment explaining a possible issue that currently occurs with a test but it is very unlikely to happen with normal usage. Here is the link https://gerrit.wikimedia.org/r/c/mediawiki/core/+/629916/4#message-25819c19986872d64b1322fdd5366ea1c4f80737

Your thoughts and opinions are very welcome.

@Addshore I believe you've worked on the watchlist before. It'd be great to hear your thoughts on https://gerrit.wikimedia.org/r/629916 whenever you get a chance.

ARamirez_WMF changed Due Date from Oct 7 2020, 4:00 AM to Oct 21 2020, 4:00 AM.Oct 8 2020, 10:07 PM
ARamirez_WMF changed Due Date from Oct 21 2020, 4:00 AM to Nov 4 2020, 5:00 AM.Oct 22 2020, 7:39 PM

This task is currently lower priority, as we are focusing on Wikisource work now. However, we may bring it back onto the board in the future. For now, I'm going to drag it back into the Estimated column.

@ARamirez_WMF, @ifried: Hi, the Due Date set for this open task is more than three months ago. Can you please either update or reset the Due Date (by clicking Edit Task), or set the status of this task to resolved in case this task is done? Thanks!