Page MenuHomePhabricator

Improve TheWikipediaLibrary guard clause to prevent spam
Open, MediumPublic

Description

Extension:TheWikipediaLibrary was deployed to Beta wiki. This uncovered a bug where at least one user was being spammed by the extension, receiving notifications on an extremely frequent basis. Users should only receive the notification once.

Per the notes in T269849#6728833, this is likely to be a result of the GlobalPreferences guard clause defaulting to assuming a user hasn't received the notification, instead of assuming they have. For users whose GlobalPreferences information isn't retrievable for whatever reason, they will receive the notification after at least every edit.

After investigating other extensions (T269849#6739769), we found that the solution is likely to be borrowing some code from another extension which will correctly check for GlobalPreferences data and fail in a more sensible way.

Acceptance criteria

  • The extension correctly handles being unable to find GlobalPreferences data, not defaulting to sending a notification if so
  • The extension is deployed to Beta Wiki again, and isn't causing a notification spam for users who originally reported this issue

Original task description
Starting in June, as far as I'm aware of, I keep getting multiple emails from wiki@wikimedia.beta.wmflabs.org in my spam folder (Yahoo Mail). It is always the same one, telling me about access to Wikimedia Library via the link https://wikipedialibrary.wmflabs.org/?markasread=****&markasreadwiki=dewiki (the markasread number changes). Looking at my spam folder now, apparently I got one on the 9th, six on the 15th, one on the 18th, five on the 22nd, five on the 23rd and another five today. It's basically every time I edit on ß-dewiki, up to five times a day. I did open the link a few times, but that didn't stop more emails from being sent. What is going on here?

Event Timeline

This seems like a bug relating to T132084 - @Catrope authored the code for that.

Ah, I forgot to mention: I have never seen an echo notification about this.

Could you paste the email text, please?

Since I posted this, I got three more emails, one in German (as usual) and two in English; probably because I visited (no edit!) some other projects from the Beta cluster.

The English message reads: Congratulations! You are eligible for Wikipedia Library access.
Apply to get free access to research
.

The German one: Herzlichen Glückwunsch! Du bist zum Zugriff auf die Wikipedia-Bibliothek berechtigt.
Bewerbung für freien Zugriff auf Forschungsdatenbanken

The first part is also used as the email subject.

I'm still drowning in WP Library emails every day! I have now deactivated wikimail there, I hope that at least will stop them, but could someone please fix this? I doesn't help the cause if it is spammed like this.

Is it sent via MediaWiki's "email this user" or in some other way? If it is, which account are they coming from? I can block that account from sending e-mail

Sorry about this - we're not actively working on this extension right now so perhaps we should disable it on beta wiki for the time being. Who could do that @Catrope @Aklapper?

TheWikipediaLibrary, as implemented in T132084.

Is it sent via MediaWiki's "email this user" or in some other way? If it is, which account are they coming from? I can block that account from sending e-mail

No, it must be a direct system message, therefore I still get the emails even after deactivating wikimail :|

Another friendly reminder: I'm still drowning in WP Library emails every day. Please do something about it!

@Catrope Would it be possible for you to disable this extension on Beta Wiki?

Change 619455 had a related patch set uploaded (by Majavah; owner: Majavah):
[operations/mediawiki-config@master] labs: Disable TheWikipediaLibrary due to email issues

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

Change 619455 merged by jenkins-bot:
[operations/mediawiki-config@master] labs: Disable TheWikipediaLibrary due to email issues

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

@Catrope Would it be possible for you to disable this extension on Beta Wiki?

Done.

The extension was disabled, leaving this task open so the cause of this bug can be fixed

Samwalton9 renamed this task from Email spam from Betawiki to Improve TheWikipediaLibrary guard clause to prevent spam.Jan 13 2021, 1:24 PM
Samwalton9 triaged this task as Medium priority.
Samwalton9 updated the task description. (Show Details)
Samwalton9 updated the task description. (Show Details)

Just noting that there are some TODOs in the patch for T271919 which need to be looked at for this task.

Change 679379 had a related patch set uploaded (by Jsn.sherman; author: Jsn.sherman):

[mediawiki/extensions/TheWikipediaLibrary@master] Rework GlobalPreferences to prevent spam

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

Change 679380 had a related patch set uploaded (by Jsn.sherman; author: Jsn.sherman):

[mediawiki/extensions/TheWikipediaLibrary@master] Use string to represent nullable boolean pref

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

Change 679381 had a related patch set uploaded (by Jsn.sherman; author: Jsn.sherman):

[mediawiki/extensions/TheWikipediaLibrary@master] Eligibility check logic is now testable function

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

Change 679382 had a related patch set uploaded (by Jsn.sherman; author: Jsn.sherman):

[mediawiki/extensions/TheWikipediaLibrary@master] TwlEligiblePresentationModel isn't namespaced

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

Change 679383 had a related patch set uploaded (by Jsn.sherman; author: Jsn.sherman):

[mediawiki/extensions/TheWikipediaLibrary@master] Prune function in includes/PreferenceHelper.php

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

Change 679384 had a related patch set uploaded (by Jsn.sherman; author: Jsn.sherman):

[mediawiki/extensions/TheWikipediaLibrary@master] check extensions in TheWikipediaLibraryHooks.php

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

Change 679385 had a related patch set uploaded (by Jsn.sherman; author: Jsn.sherman):

[mediawiki/extensions/TheWikipediaLibrary@master] Tests cover eligibility, not page saves

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

Change 679385 abandoned by Jsn.sherman:

[mediawiki/extensions/TheWikipediaLibrary@master] Tests cover eligibility, not page saves

Reason:

I am a gerrit noob

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

Change 679379 abandoned by Jsn.sherman:

[mediawiki/extensions/TheWikipediaLibrary@master] Rework GlobalPreferences to prevent spam

Reason:

I am a gerrit noob

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

Change 679380 abandoned by Jsn.sherman:

[mediawiki/extensions/TheWikipediaLibrary@master] Use string to represent nullable boolean pref

Reason:

I am a gerrit noob

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

Change 679381 abandoned by Jsn.sherman:

[mediawiki/extensions/TheWikipediaLibrary@master] Eligibility check logic is now testable function

Reason:

I am a gerrit noob

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

Change 679382 abandoned by Jsn.sherman:

[mediawiki/extensions/TheWikipediaLibrary@master] TwlEligiblePresentationModel isn't namespaced

Reason:

I am a gerrit noob

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

Change 679383 abandoned by Jsn.sherman:

[mediawiki/extensions/TheWikipediaLibrary@master] Prune function in includes/PreferenceHelper.php

Reason:

I am a gerrit noob

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

Change 679384 abandoned by Jsn.sherman:

[mediawiki/extensions/TheWikipediaLibrary@master] check extensions in TheWikipediaLibraryHooks.php

Reason:

I am a gerrit noob

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

Change 679389 had a related patch set uploaded (by Jsn.sherman; author: Jsn.sherman):

[mediawiki/extensions/TheWikipediaLibrary@master] Rework includes/ code to prevent spam

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

Change 679389 merged by jenkins-bot:

[mediawiki/extensions/TheWikipediaLibrary@master] Improve code quality

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

We should be ready to re-enable in beta now that Change 679389 is merged.

Change 685520 had a related patch set uploaded (by Jsn.sherman; author: Jsn.sherman):

[operations/mediawiki-config@master] labs: Enable TheWikipediaLibrary

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