Page MenuHomePhabricator

Watchlist Expiry: update watchlist email notifications [SMALL]
Closed, ResolvedPublic

Description

As a watchlist expiry user, I want expired items to be excluded from my email notifications, so that the email notification tool properly reflects pages on my current watchlist.

NOTE: The logic behind when you receive an email notification is a little complicated from what I have seen, so someone else might need to clarify the above for me. --> we'll discuss in estimation

Background: As a Watchlist Expiry user, I only want to get email notifications for pages I am currently watching. I don't want to get notifications for expired watched items. For this reason, we need to ensure that expiring items are not included in the email notifications.

Acceptance Criteria:

  • No notification email should be sent when:
    • An edit is made to a temporarily watched page that has expired
  • An email should be sent when:
    • An edit is made to a page that is permanently watched
    • An edit is made to a page that is temporarily watched & the watch period has not expired

Steps to reproduce problem:

  1. Log in as UserA, go to Special:Preferences, check the option "Email me when a page or a file on my watchlist is changed" and save
  2. Watch $page temporarily and let it expire (e.g. use API to watch for 1 second: Special:ApiSandbox#action=watch&expiry=1 second&titles=$page)
  3. Log in as UserB (or anon.), edit $page

Expected behavior: UserA does not receive an email notification for the edit in step 3
Observed behavior: UserA does receive an email notification

Event Timeline

ifried created this task.May 18 2020, 4:18 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 18 2020, 4:18 PM
dom_walden updated the task description. (Show Details)May 20 2020, 2:11 PM
ifried updated the task description. (Show Details)May 21 2020, 4:59 PM
ARamirez_WMF renamed this task from Watchlist Expiry: update watchlist email notifications to Watchlist Expiry: update watchlist email notifications [SMALL].May 21 2020, 5:20 PM
ARamirez_WMF moved this task from To Be Estimated/Discussed to Estimated on the Community-Tech board.

Change 606245 had a related patch set uploaded (by MusikAnimal; owner: MusikAnimal):
[mediawiki/core@master] Filter out expired watched items when sending email notifications

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

Change 606245 merged by jenkins-bot:
[mediawiki/core@master] Filter out expired watched items when sending email notifications

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

dom_walden added a subscriber: dom_walden.

This change updates two functions:

  1. updateNotificationTimestamp
    • Which finds all the (non-expired) watchers of a page who don't have wl_notificationtimestamp already set, updates their wl_notificationtimestamp and returns list of watchers.
  2. notifyOnPageChange
    • Which calls updateNotificationTimestamp and sends an email to the list of watchers returned (modulo other preferences listed below and whether user has correct permissions)

So, now, expired watchers are not emailed notifications and don't have their wl_notificationtimestamp updated.

I confirmed this was the case on my local vagrant with watchlist expiry enabled and disabled.

There are a few options in Special:Preferences which also determine whether or not a notification gets sent:

  • "Email me when a page or a file on my watchlist is changed"
  • "Email me when my user talk page is changed" (this is always true on beta, test and production)
  • "Email me also for minor edits of pages and files"

I systematically tested all these combinations on beta to check that notifications are being sent as appropriate, for permanently, temporarily and expired watched pages, including major and minor edits.

For regression purposes, I repeated this on testwiki (which has watchlist expiry disabled).

updateNotificationTimestamp is also called by:

If you have Flow enabled on your User_talk, you will get an email notification every time someone posts on your User_talk.

This is regardless of whether your User_talk is watched or not, whether watchlist expiry is enabled or not, whether the watch is permanent, temporary or expired.

I did not test Sanctions, because I don't think it is on production.

Test environments:

  • en.wikipedia.beta.wmflabs.org: MediaWiki 1.35.0-alpha (6d8e641) 09:59, 1 July 2020
  • test.wikipedia.org: MediaWiki 1.35.0-wmf.39 (rMWd21694a25e89) 18:12, 30 June 2020
  • Local vagrant: MediaWiki 1.35.0-alpha (1913d1b)
Restricted Application edited projects, added Community-Tech; removed Community-Tech (Kanban-2020-21-Q1). · View Herald TranscriptJul 14 2020, 7:21 PM
ifried closed this task as Resolved.Aug 19 2020, 7:42 PM

I have tested this on testwiki, and it looks good. I watched a page for a very short period of time (1 second) via the API Sandbox, and then I made a change to the page as another user. No email was sent when a change was made. Meanwhile, an email was sent regarding a change to the page when a longer time period was selected (i.e., it had not yet expired). I'm marking this work as Done.